|
Cross posting is just rude. Especially for a question that's easily answered with google. Cross posting it into the lounge is even worse, although I answered it there, as it's not quite a programming question.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Are you asking whether your application needs the .Net framework? If so then yes you do and the answer would be that you your client needs to install it.
However, you can package dotnetfx along with your application in your installer project and then you can conditionally run it if there is a need (i.e. if its not installed). Saves them the hassle of downloading it
There are 10 kinds of people in this world. Those who understand binary and those who don't...
______________________
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
|
|
|
|
|
Hallo,
Assume that in a Web Service application under .NET in C#, there is a Web Service method that returns an object of type DataTable..
When a client, to this Web service, calls this method, does the resulting object completely (with its all contents) return to the caller platform? Or returns only a reference to an object of DataTable?
In other words: Is the actually created object (DataTable) held by WebService apllication?
Or is it sent with its whole contents to the client (caller) platform, becoming independent from the connection to WebService anymore??
|
|
|
|
|
First, unless you have created your own version of a serializable DataTable, a web method cannot return a DataTable because it is not serializable. However, a DataSet is serializable and thus you can use it to put your data table in it and return it.
Now, as I believe, a web service is stateless by nature. You can make it statefull with some extra coding but if you use the model generated by VS, it is stateless. This means that there is no persistence of data and when a method returns, the session expires.
So, to answer your question, the client calling the webmethod will get a copy of the DataSet returned and not a reference
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Thanks for your help Talal.
As I am very beginner about WebService, I would like to ask another question upon your remarks: Cannot I use my self-defined type (class) objects in Web Service methods (as a function return type or parameters for functions), if those my-self designed classes are not serializable ?
|
|
|
|
|
You're welcome. I'm glad I can help.
For your classes to be serializable, they need to contain only serializable objects. You can check on MSDN what are the serializable objects. Usually you can have all primitives types like int, string, byte, bool, long, float, etc... as well as arrays of these like int[], byte[], string[] etc...Other types may also be serializable (like DataSet).
If you have a class "A" [being used by the web service] that contains some variables that are not serializable, I suggest you move all the serializable variables (those you want to send across the network) to a new class and reference that class in your class "A".
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Hi fellas.
I am writing a association membership system for my Final Year Project. However I have a few concerns and needs some help.
1. I spoke to my professor, who saids the size of the members in the associate is around several hundreds, maybe a little over a thousand max. I wanted the simpliest database possible. Could Access be able to handle the job? Is it reliable and secure?
2. A friend of mine told me Access only allows 1 database connection at a time. Is this true? Can anyone vouch for this?
3. This is the most important question. The site I am building is a generic one. It will be used in several associations for real. I can safely assume that different associations uses different fields for their databases. Is it possible that I can write an initial setup page, where the user could define the fields involved, then a customized database could be generated? Is it possible?
Thanks and looking forward to you guys' replies!!!
|
|
|
|
|
Access is reliable. No database is 'secure', if you mean, can it hide your data. A SQL Server install at least requires a password, I don't know if Access offers that
It's probable that Access limits the number of connections.
Actually, let's be clear here. You're talking about a Jet database, an MDB file. Access itself actually prefers to store data in SQL Server, if it can. Sql Server Express Edition is free, the main benefit of Access, is that an MDB is easy to deploy.
I don't know if you can create an MDB in pure C#, no. You can do it using some C++ APIs, I am pretty sure, you could p/invoke those. However, it's perhaps easier to build a database that is able to store a flexible schema, or, perhaps one that stores field names apart from the column names. I mean, how generic can it be, and your code still be useful ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Wel I am sory I cant tell you exact code but I have seen a .Net project by one of my classmate who generated an Access database through c# code.
I mean its possible. If I find that code I'll surely post it here.
But try to google it out you'll find it.
Mujtaba
|
|
|
|
|
Hi,
Well I'm not a big fan of Access so my knowledge is limited but here goes.
Point 1: Access will handle well the data and I think it will be reliable. For security, it will use a username and a password like an SQL database. Now, the problem with Access in my opinion is that it's just one file. So any mistake in file manipulation and it can just be deleted.
Point 2: I don't know honestly but I would be surprised if it was true...
Point 3: In my opinion, you cannot do anything on that level but I could be wrong. I don't know if you can create tables on the fly, maybe with VBScript or something. I know that in SQL Server, you can use SQL scripts to do that. Finally, in my opinion, it is never a good idea to have a dynamic database like that. I think it will be a big mess to write code to insert and update records for that kind of implementation. But that's just my opinion
Talal
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Hi there for all the replies.
However it seems there are more and more question marks for now.
The reason I choose Access is because of simplicity, everything is stored in a file; all I have to is upload a file and voila.
What happens if I had 2 people accessing the same piece of data, and coincidently modifying it at the exact same time (with Access). Could the results be disastrous?
How exactly does those M$ SQL Server and Oracle work? How do I upload the database to the webserver. Is there any database files (as with Access?) for SQL Server? I've been long baffled by the this. And is M$ SQL server free for download?
I also spoke to someone else, he said I could give SQL-Lite a try, exactly what is it?
I can assume that I am able to create databases on the fly with SQL Server?
Thanks a big bunch for the replies!!!
|
|
|
|
|
Infernojericho wrote: The reason I choose Access is because of simplicity, everything is stored in a file; all I have to is upload a file and voila.
Yes, that's all it has going for it.
Infernojericho wrote: Could the results be disastrous?
I'm not really sure what concurrency support Access has, how many users are you thinking of ? More than one user, implies that this is a distributed app, so it probably makes sense to consider setting up a SQL Server instance on the server. Having the DB on the server negates any question of security, it's access to the server that is your first line of defence there.
Infernojericho wrote: How exactly does those M$ SQL Server and Oracle work?
They use services to run their main program, and they also create just a data file, the difference is simply that the main DB has to be connected to it.
Infernojericho wrote: How do I upload the database to the webserver.
The way I do it, when I have to, is to do a backup of my local DB, then copy the file to the server, terminal services in, and use the local SQL Server to restore my backup file.
Infernojericho wrote: And is M$ SQL server free for download?
SQL Server is actually cheap, compared to Oracle, but it's quite expensive, in real terms. As I said previously, SS Express is free, it only allows 5 connections or something, tho. If this is a web app, and you get it hosted, you may want to look into MySQL, just because a lot of hosts support it, I believe. But, I am sure you can find hosts with SQL Server hosting.
Infernojericho wrote: I also spoke to someone else, he said I could give SQL-Lite a try, exactly what is it?
Never heard of it, could he mean SQL Server Express ?
Infernojericho wrote: I can assume that I am able to create databases on the fly with SQL Server?
SQL Server is a real database, Access isn't quite. You can run any SQL you like on a SQL Server instance, and you can write SQL to create any database.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Christian Graus wrote: The way I do it, when I have to, is to do a backup of my local DB, then copy the file to the server, terminal services in, and use the local SQL Server to restore my backup file.
I have a question concerning that matter. I know it's not the right thread or forum maybe but since you mentionned it...
I ran into that problem. I had my SQL Server 2005 database on the dev server and we wanted to copy the data to the testing server. The first thing I thought of was backup and restore but it didn't work.
The backup went well but when i took the file and tried restoring, it kept saying that this backup file was not made for that database.
I was wondering if there are special flags or configurations to set for it to work. The way I did it was just to have the same database on both sides, i.e. same tables (but empty) and same stored procedures. And then I ran the backup procedure with the default settings.
Could you please tell me what might be wrong?
Thanks
-- If this is a post that has been helpful to you, please vote for it. Thank you!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Infernojericho wrote: The reason I choose Access is because of simplicity, everything is stored in a file; all I have to is upload a file and voila.
True, but the basics of SQL Server are not much different from the basics of Access.
Infernojericho wrote: What happens if I had 2 people accessing the same piece of data, and coincidently modifying it at the exact same time (with Access). Could the results be disastrous?
This is an issue for all databases. If 2 users try to concurrently write records in SQL its just as problematic. You must deal with concurrency issues whatever database you choose.
Infernojericho wrote: ow do I upload the database to the webserver. Is there any database files (as with Access?) for SQL Server? I've been long baffled by the this. And is M$ SQL server free for download?
Using the term "M$" looks childish. Microsoft is a corporation and just like all corps they like making $$$. Choose MySQL or some other open source database if you are offended by a commercial entity making money!
In answer to your question. There are database files with SQL Server in a similar way to access. There are 2 files representing the database and the transaction log - it is NOT just a case of copying them to a server though - they must be attached to an instance of a running SQL Server. You can also backup your local copy (used in development) and restore that to the sql server instance at your hosting provider. SQL Server express edition (a cut-down local version of the server but fully featured) is free.
Infernojericho wrote: I also spoke to someone else, he said I could give SQL-Lite a try, exactly what is it?
A competing product for the likes of SQL Server express.
Infernojericho wrote: I can assume that I am able to create databases on the fly with SQL Server?
You can, but as you've already been advised its a really really really bad idea! Read up on defining a database schema that is dynamic by design.
|
|
|
|
|
hi
Infernojericho wrote:
Could the results be disastrous?
if 2 users accessing the same piece of data
are you responsible to handle this, access do not support transaction's.
the maximum users allowed in access are 256. look at the *.ldb file
created by access. this file is created every time a user open a *.MDB database
if the file exist, the user is added to it.
the file-structure is limited to 256 records. each record contains
the user name, machine name and any table-loking.
regards
|
|
|
|
|
I am using VS 2003 .Net framework. I have to integrate the web application with active diretory. I browsed net i found the below code.no luck there.
i dont know how to solve the error.
void Page_Load(Object Src, EventArgs E )
{
if(!Page.IsPostBack)
{
lblMessage.Text = "use domain\\username format";
}
}
private void AuthenticateUser(object sender, EventArgs e)
{
string ldapPath = "LDAP://dc=domain",DC=dn;
DirectoryEntry de = new DirectoryEntry(ldapPath);
de.Username = txtUsername.Text;
de.Password = txtPassword.Text;
de.AuthenticationType = AuthenticationTypes.Secure;
try
{
string name = de.Name; //force a bind
lblMessage.Text = "Success, You have authenticated";
}
catch(Exception ex)
{
lblMessage.Text = "Failure: " + ex.Message;
}
finally
{
de.Close();
}
}
User name
<asp:textbox id="txtUsername" runat="server">
password
<asp:textbox id="txtPassword" runat="server" textmode="Password">
<asp:button id="btnSubmit" onclick="AuthenticateUser" runat="server" text="Submit">
<asp:label id="lblMessage" runat="server">
User name:
<%=User.Identity.Name %>
My process is running as:
<%=System.Security.Principal.WindowsIdentity.GetCurrent().Name %>
I am getting the following exception:
Failure: System.Runtime.InteropServices.COMException (0x8007054B): The specified domain either does not exist or could not be contacted at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_Name() at ASP.index_aspx.AuthenticateUser(Object sender, EventArgs e)
please advice on this
|
|
|
|
|
As is says, Your domain name is wrong. You need to provide valid domain name.
To know your domain name you may contact your network administrator.
See if the following link is useful for you http://forums.asp.net/p/943717/1340605.aspx[^]
|
|
|
|
|
thanks for your reply.
I checked the name.It is not working. Do i have to use DirectorySearcher to check the user name?
All i have to do is that, i have to get the user name who is currently logging in.
|
|
|
|
|
See if you are authenticating an user by providing a username or against a active directory, then you can get the user name. Its is not possible to get the currently logged in user name from a client system, if he is in someother network.
|
|
|
|
|
thanks a lot sathish.
I am through.I did a mistake in DirectorySearcher.
|
|
|
|
|
This should work for you. You need to specifiy the domain controller server name including its domain name in full. The following code should make things alot clearer.
DirectoryEntry de= new DirectoryEntry();
de.Path = "LDAP://clown.acme.com"; //clown is the server name hosting the domain controller & acme.com is the domain name.
de.Username = "administrator";
de.Password = "passw$rd";
de.AuthenticationType = AuthenticationTypes.Secure
//now lets search for a user using the above credentials
try
{
DirectorySearcher searcher = new DirectorySearcher();
searcher .SearchRoot = de;
searcher .Filter = "(cn=" + "Domin Admins" + ")";
SearchResultCollection results = searcher .FindAll();
Console.Writeline(results.Count.ToString())
}
catch (Exception exception)
{
Console.Writeline(exception.Message);
}
|
|
|
|
|
I saw an interesting point raised here: http://www.atrevido.net/blog/2007/08/02/C+Frustration.aspx[^]
The C# 3 spec does not permit assigning a labmda expression to type infered value. So the following statement is invalid:
var Add = (int a, int b) => a + b;
The keyword var will give error CS0815, "Cannot assign 'lambda expression' to an implicitly typed local".
If the type is changed from var to Func<int, int, int> , the error goes away. The type of this lambda expression is not ambiguous, so the error must simply be a limitation in the type inference. Does anyone know if Microsoft has plans to fix this issue? If the type is known and expressible as a variable, then I see no good reason why this variable should behave differently than any other type-infered generic variable.
I ran into this problem while using VS2008 beta 1, so if it works in beta 2, please let me know.
-sharoz
|
|
|
|
|
Have you looked to see if this isssue has been raised on http://connect.microsoft.com[^]?
Thats were bugs and suggestions are reported back to MS and where they give answers to those bugs and suggestions.
If theres nothing there already about this you might want to submit some feedback and they *might* change it. If theres already feedback about it then you can show your support for it ... the more support for an issue, the more likely they are to do something about it.
|
|
|
|
|
|
And they've already replied
Thanks for your feedback. We have reproduced this bug on Vista and OrcasBeta2VSTS, and we are sending this bug to the appropriate group within the Visual Studio Product Team for triage and resolution. Thank you, Visual Studio Product Team.
Posted by Microsoft on 20/08/2007 at 02:24
of course this doesn't mean they'll defiantly do something about it ... but atleast they are looking at it
|
|
|
|
|