Fill Labels with SQL Search Results .Net
-
I need help finishing the code t fill the labels on my form with the search results. this i what i have (Not even sure this is gonna work as well )
Dim Cnxn As New ADODB.Connection Dim cmdChange As ADODB.Command 'Connection String Dim strCnxn As String 'SQL Query Dim strSQL As String 'search criteria Dim strSearchLName, strSearchFName As String Dim Now As DateTime Dim UserPassID As Integer UserPassID = Val(lblPassID.Text) strSearchLName = txtLName.Text strSearchFName = txtFName.Text ' define strSQL to insert the fields strSQL = "SELECT * FROM Contacts WHERE (LName) = '" & strSearchLName & "' AND (FName) = '" & strSearchFName & "'" strCnxn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\RMSC LOGIN\MYDataBase.mdb;Persist Security Info=False" Cnxn = New ADODB.Connection Cnxn.Open(strCnxn) cmdChange = New ADODB.Command ' Create command object cmdChange.ActiveConnection = Cnxn cmdChange.CommandText = strSQL cmdChange.Execute() ' execute the SQL command ' Fill the Labels with the Search results **This is where i Fail !!!!!** Cnxn.Close() ' Close everything Cnxn = Nothing
Any Help would be appreciated Thank you the detail!!!! form name Contactinfo labels on theForm as follows.... lblFName lblLName lblAddress lblCity lblState lblZip lblPhone lblEmail lblPassID if possible this is gonna run in button Click event Thank You Scholars!!!:laugh: Help is great only if yu ask correctly