Tools->Connect To DataBase
Provider tab ->Microsoft OLE DB Provider for SQL Server
Connection tab ->Select or enter server name :
-type localhost if the SQL database is running on your machine
- type the server name where SQL is running. This should be on the network where is your machine.
Check "Use a specific user name and password"
Fill User Name and Password that should be defined in that SQL
Check "Select the data base files as a database name " , type there the name of the Database
Click Test Connection
If you get "Test connection succeeded" that means you are able to connect.
If not, the reasons could be:
-the server name is wrong or cannot be reached. In this case try Tools->Connect to Server;
-the SQL is not running on that machine
-the selected database does not exists
-username/password are wrong
If the test is Okay then you can use Designer to generate the SqlConnection object and the connection string just you drag the item from the Server Explorer ->Data Connection tree onto your form.
You should connect in this case from that code.
-obislavu-
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.