HOW TO CONNECT VS2005 TO SQL2005

5 pts.
Tags:
SQL
SQL Server 2005
Visual Studio 2005
Dear sir,

how to connect vs2005 to sql2005 and which setting do in vs2005 and sql2005

 

 



Software/Hardware used:
how to connect vs2005 to sql2005 and which setting do in vs2005 and sql2005

Answer Wiki

Thanks. We'll let you know when a new response is added.

More details are needed here.

If you want to connect a control to the database, say a DataGrid, then a wizard will be presented when creating the control, and you wouldn’t have to write any code to create the database connection.

If you want to connect by code, then you would write some code like this (this example shows a connection to an express edition server):

<pre>Imports System.Data.SqlClient


Dim conString As String = “Data Source=YourMachine\SQLEXPRESS;Initial Catalog=YourDatabase;User ID=YourUserID;Password=YourPassword”
Dim conn As SqlConnection

conn = New SqlConnection
conn.ConnectionString = conString
conn.Open()
If conn.State = Data.ConnectionState.Open Then

End if
conn.Close()</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following