hey all... my project is showing some error in this code... plz help...

Dim RS As New adodb.Recordset
Dim getname As String
Dim logginname As String
getname = "SELECT E_name FROM Employee_Details WHERE E_ID ='" & logid.Caption & "'"
CN.Execute getname
RS.Open getname, CN
Label7.Caption = RS.Fields(0)

thnx! good day!

What error message exactly?

Do you have CN open?

Dim CN As ADODB.Connection
CN = New ADODB.Connection
CN.Open "<connection string>"

Also the recordset could be empty:

If RS.Fields.Count > 0 Then
  Label7.Caption = RS.Fields(0)
Else
  Label7.Caption = ""
End If

thax... worked great... hv a good day!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.