0

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

1
  • The server is part of the connection string, so as long as your client can get to the SQL Server computer you should be fine. Commented Apr 25, 2011 at 2:30

3 Answers 3

3

The usual suspects / problems to access SQL remotely are:

  • Enable TCP/IP protocol in SQL server
  • Open up firewall to let SQL traffic through (usually port 1433)
  • Configure SQL server to allow remote connections, run Browser Service
  • Use the right credentials to address your SQL server instance
Sign up to request clarification or add additional context in comments.

1 Comment

How to enable a client PC to see the database which on another PC which has a sql server management studio, in my application, is there any change i should made in the connection string in application.exe.config file or not? as the client computer can't connect to the database
2

There are four basic things that are required...

  1. 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.

  2. In your application there are choices as to "how to connect", but my experience is you want to use the .Net SQLClient

  3. You need an understanding of how to invoke an sql statement on the server through direct sql or stored procedures.

  4. 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. How do I deploy the database to a new server?
  2. How do I connect my window forms application to that new database?

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.

1 Comment

yes i used .Net SQLClient to connect to database from my application and used a stored procedure , the problem i'm in it, when i deploy my project and setup it in more than one pc connected to each other by a network and i want to put MS SQL server and a database on one pc in the network to act as a server ,what the requirement to do that
0
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.

1 Comment

Thanks , but the connection string i did it in my code i man how to connect to MS SQL server through a network like a windows application on a pc and the database on another pc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.