I am working in sql2000 database as backend and Vb6 as frontend. Its for bank scenario I am trying to display the balance corresponding to particular account number.
Do try to help. Following is my code.
*************************************
Private Sub Command1_Click()
Dim con1 As New ADODB.Connection
Dim cmd1 As New ADODB.Command
Dim rs1 As New ADODB.Recordset
Dim accessconnect As String
accessconnect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=POOJA-D4FD585E2\SQL2000"
con1.ConnectionString = accessconnect
con1.Open
cmd1.ActiveConnection = con1
cmd1.CommandText = "select balance from account where account_number = ' " & (Text1.Text) & " '"
Set rs1 = cmd1.Execute
If (rs1.EOF = Flase) Then
Text2.Text = rs1("balance")
Else
Text2.Text = " "
MsgBox ("Invalid account number")
End If
con1.Close
End Sub
**************************
THANK YOU