Hi,
I need your kind assistance on how to retrieve data from SQL Server using VB6.
The connection string that I used is:(I’m not quite sure on whether my coding is correct.Kindly comment on any errors I have made.)
Public Sub Database_Connection()
Dim i As Integer
Dim strSQL As String
Dim oRS As ADODB.Recordset
Dim oConn As ADODB.Connection
oConn = New ADODB.Connection
oRS = New ADODB.Recordset
strCS = “Provider = SQL.OLEDB.1;” & _
“Integrated Security = SSP1;” & _
“Persist Security Info=False;” & _
“Initial Catalog=BookRecords;” & _
“Data Source = dweappdmy01\eportal;” & _
“UID=sa; PWD=pass;”
oConn.ConnectionString = strCS
oConn.Open
———————————————–
Below is how I’m currently doing it.Is this correct?
oRS.Recordset
.Fields(“Title”) = txtTitle.Text
.Fields(“Pub_Year”) = txtPub.Text
.Fields(“Pub_ID”) = txtPubID.Text
.Fields(“ISBN”) = txtISBN.Text
.Fields(“Subject”) = txtSubject.Text
Thank you.