Reputation: 37
What is required to use a Windows form application use a SQL Server database thrugh network?
I want to install a SQL Server on 1 PC that has a Windows XP OS as a server. And, through a network I want the application to connect to a database.
So, I know that I should setup .Net Framework 4.0 to the application and I did a deployment to my project. I don't know if I need any application to install to do this connection like a server application or not?
Thanks in advance
Upvotes: 0
Views: 1658
Reputation: 2063
SqlConnection myConnection = new SqlConnection("user id=username;" +
"password=password;server=serverurl;" +
"Trusted_Connection=yes;" +
"database=database; " +
"connection timeout=30");
http://www.codeproject.com/KB/database/sql_in_csharp.aspx
Try that.
Upvotes: 0
Reputation: 5084
There are four basic things that are required...
There are limits on installing server software on a desktop OS (Traditional SQL server will not install on XP) So you need to understand what you can install and where.
In your application there are choices as to "how to connect", but my experience is you want to use the .Net SQLClient
You need an understanding of how to invoke an sql statement on the server through direct sql or stored procedures.
You need to understand what to expect in return from a query (nothing, scalar value, returned parameters, recordset...) and what to do with it when you get it...
For more information, please post examples of what you have tried, what the result was and what (specifically) you are trying to accomplish.
Edit after comment from @Marziana
As I read you comment I believe there are two questions:
1) Out of your original question, installing MS SQL server (standard edition) will NOT install on MS Windows XP. You need a Windows Server Software installation onto which you may install SQL Server. Your other option is to install a lesser edition of SQL Server to install on XP (such as SQL Desktop Edition, Evaluation Edition or Personal Edition).
2) The "Connection String" is the directive to the connection object telling what server to locate (and what instance of SQL on that server), which database to attach to on that server (the "initial catalog"), the security model to implement and the credentials (Username/password) to use if not using "integrated" security). If you "hard coded" your connection string then that makes it impossible to change the connection string to adapt to a new database server/dbname/credentials.
Beyond that your question is overly broad for a more direct answer.
Upvotes: 2
Reputation: 160882
The usual suspects / problems to access SQL remotely are:
Upvotes: 3