Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can't create a connection of VB.net 2008 with SQL Server 2008,
Please send me the code of the same
Posted
Comments
Abhinav S 16-Dec-10 5:38am    
What have you tried so far?

Google really is the first place you should look. I googled "database connection with VB.Net", and this was the first of over 1.8 MILLION results:

http://www.homeandlearn.co.uk/net/nets12p4.html[^]
 
Share this answer
 
www.connectionstrings.com[^] is good for getting connection strings to any database.
 
Share this answer
 
v2
Comments
Toniyo Jackson 16-Dec-10 8:21am    
Modified link
VB
Dim sConnect as string
sConnect &= "Data Source=" & ServerName & ";"
               sConnect &= "Initial Catalog=" & Database & ";"
               sConnect &= "User Id=" & UserName & ";"
               sConnect &= "Password=" & Password & ";"
             
addConnection = New SqlConnection

           If addConnection.State = ConnectionState.Open Then addConnection.Close()
           addConnection.ConnectionString = sConnect
           addConnection.Open()
           addCommand = New SqlCommand

Do what you want with this SqlCommand
 
Share this answer
 
Comments
Mudasar Ahmad 18-Dec-10 3:16am    
but dear Manoj how i configure sql server 2008 & what are the steps , please send me
Mudasar Ahmad 18-Dec-10 3:21am    
i install the visual studio 2008 SP1 express edition with SQL Server 2008, please send the procedure how i add a new datasource

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900