Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. connection to table and display results to labels

connection to table and display results to labels

Scheduled Pinned Locked Moved Database
databasehelpcsharpsecurity
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jlawren7
    wrote on last edited by
    #1

    hi all i'm using VB.Net and i have a form that i need to have the results displayed into labels that populate the form. this is what i have so far **************** CODE ***************** Private Sub SearchTBBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SearchTBBtn.Click 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) 'Now = DateTime() ' Now = Format(Now, "h:nnAM/PM") strSearchLName = txtLName.Text strSearchFName = txtFName.Text ' define strSQLUpdate 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 fields with the results '************* This is where i have a problem Dim rsContact As New ADODB.Recordset rsContact = cmdChange lblPassID.Refresh() lblLName.Refresh() Cnxn.Close() ' Close everything Cnxn = Nothing End Sub *************** END CODE ****************** i guess i don't knowhow to populate the labels with the results of cmdChange any help would be great thank you Help is great only if yu ask correctly

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups