Thursday, March 22, 2012

Connectivity between vb 6.0 and Sql server 2000 (data base is in Server)

Hai all
I am sudhir
I am facing problem to establish connection between vb 6.0 and ms sql
server 2000, ie data base is in Server. I want to make conneciton
between them.
please help me.
Advance thank you alll
' Basic ADO
Dim strConnectionString as String
Dim myConn as ADODB.Connection
Dim myRS as ADODB.Recordset
' This uses the SA username, but you can create / use another
strConnectionString = "Provider=SQLOLEDB.1;Password=MySAPassword;Dat a
Source=MyServerName;User ID=SA;Initial Catalog=MyDBName;"
Set myConn = New ADODB.Connection
myConn.Open strConnectionString
set myRS = myConn.Execute "SELECT MyCol From MyTable"
If not myRS.EOF then
myRS.MoveFirst
While Not myRS.EOF
' Read stuff out of the recordset
Msgbox mrRS!MyCol
mrRS.MoveNext
Wend
End If
Jamie Clancy
Ulysses Systems, London
"sudhir9992003@.gmail.com" wrote:

> Hai all
> I am sudhir
> I am facing problem to establish connection between vb 6.0 and ms sql
> server 2000, ie data base is in Server. I want to make conneciton
> between them.
> please help me.
> Advance thank you alll
>

No comments:

Post a Comment