Reputation: 1
I know connection of MS Access and VB. I don't know connection of SQL with VB. Please provide some code examples.
Upvotes: 0
Views: 372
Reputation: 32760
Assuming MS SQL and VB6, try this article:
Connecting to a SQL Server database using ADODB
Edit: Whoops, assumed wrong.
You can also visit ConnectionStrings.com for other connection strings, such as SQL 2005 and SQL 2008.
Upvotes: 2
Reputation:
Here's some basic code using VB.NET that will open and close a connection to MSSQL:
Imports System.Data.SqlClient
Dim SqlConn As New SqlConnection
SqlConn.ConnectionString = "Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;"
SqlConn.Open()
SqlConn.Close()
SqlConn.Dispose()
That should meet your request i believe. If it is indeed VB6, then it will be a completely different syntax.
Upvotes: 2