N/APosted on - 03/11/2012
my problem is how to make relation between Visual basic 2008.. and sql server 2005 .. i need some codes i think to make that .. but iam beginner ..
please anyone can help me
How to connect vb.Net 2008 with SQL server 2005
Yes you are right, there are some codes that we need to do this work.
For this purpose make sure that the project on which you are working has a reference to System.Data.SqlClient namespace.
If you want to add the namespace follow these steps:
1. Open your project.
2. Here on the .NET tab, Add option of reference menu in Visual Basic.
3. In the list find System.Data.SqlClient. Once find, select it and press OK.
4.Now you have to add "import a statement" from the Declaration section. This statement is as follow
5. After, you have done all this, you are ready to make a relation between VB and SQL with the help of this code:
Dim cn As New SQLConnection
' Set the connection string.
cn.ConnectionString = "SERVER=.SQLEXPRESS;Integrated Security=TRUE"
' Open the connection.
Catch ex As Exception
' Display error messages.
MessageBox.Show("Connection error: :" & ex.ToString())
' Close the connection.