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. General Programming
  3. Visual Basic
  4. Linking text boxes to a database without being databound

Linking text boxes to a database without being databound

Scheduled Pinned Locked Moved Visual Basic
databasequestion
2 Posts 2 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.
  • D Offline
    D Offline
    Dave McCool
    wrote on last edited by
    #1

    I have a program that what I want to happen is, when you type something into "txtEmployee" it will search the employeeID field in employee table and a message should appear saying "This employee does not exist" or show their details in "txtAddress" (Address 1 in table) "TxtPostcode" (Postcode in table) Now what I don't want to happen is for the textboxes to be databound to the table fields, as I only want the textboxes to connect to the database table fields whenever I type something in. How would I do all this? Thanks in advance

    In the end we're all just the same

    J 1 Reply Last reply
    0
    • D Dave McCool

      I have a program that what I want to happen is, when you type something into "txtEmployee" it will search the employeeID field in employee table and a message should appear saying "This employee does not exist" or show their details in "txtAddress" (Address 1 in table) "TxtPostcode" (Postcode in table) Now what I don't want to happen is for the textboxes to be databound to the table fields, as I only want the textboxes to connect to the database table fields whenever I type something in. How would I do all this? Thanks in advance

      In the end we're all just the same

      J Offline
      J Offline
      JernejR
      wrote on last edited by
      #2

      You should do something like that: Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Dim txt, SQL As String txt = Me.TextBox1.Text.Trim 'you should connect to DB only if lenght is greater for example 3 If txt.Length > 3 Then SQL = "select EMP_ID from EMP_TABLE where EMP_ID like '" & txt & "%'" Dim dt As DataTable 'call some your function that returns datatable or. write code here 'dt = getDatatable(SQL,"SOMETABLE") If dt.Rows.Count = 0 Then MsgBox("This employee does not exist") End If End If End Sub

      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