VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code is used to connect to sqlserver using ADO code and access the data on the SQLServer.

by Mr. Lokendra Dhakal (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 4th April 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code is used to connect to sqlserver using ADO code and access the data on the SQLServer.

API Declarations


Dim rs As ADODB.Recordset


Rate This code is used to connect to sqlserver using ADO code and access the data on the SQLServer.



Private Sub Form_Load()
Set cnn = New Connection
Set rs = New Recordset
With cnn
    .Provider = "sqloledb"
    .ConnectionString = "user id=username;,data source=databasename;initial catalog=databasename"
    .Open
End With
rs.Open "select * from tablename", cnn
Call display
End Sub

****--- Create a function that displays the records after connection is established -- -***
Sub display()
txtcid = rs!custid
txtname = rs!Custname
txtadd = rs!address
txtph = rs!phone
End Sub


Download this snippet    Add to My Saved Code

This code is used to connect to sqlserver using ADO code and access the data on the SQLServer. Comments

No comments have been posted about This code is used to connect to sqlserver using ADO code and access the data on the SQLServer.. Why not be the first to post a comment about This code is used to connect to sqlserver using ADO code and access the data on the SQLServer..

Post your comment

Subject:
Message:
0/1000 characters