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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. displaying info from database [urgent pls help]

displaying info from database [urgent pls help]

Scheduled Pinned Locked Moved Visual Basic
databasehelp
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.
  • K Offline
    K Offline
    kyosugi
    wrote on last edited by
    #1

    1st, i check for a valid id for the user n if its valid, a new form will show the new form contains textboxes and a combo box i would wan the textboxes and the combo box to display the corresponding stuff from the database for exmaple name: my name address : my address the followin is the code i used -------- this 1 is which i validate the id, it works, but jus in case i wana know if the other code did not work because of it -------- Private Sub submitB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submitB.Click Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jasmine\My Documents\project\db1.mdb" Dim con As OleDb.OleDbConnection Dim dr As OleDb.OleDbDataReader Dim cmd As New OleDb.OleDbCommand Try Dim strselect As String = "Select BorrowerId from member where BorrowerId = '" & idTB.Text & "'" 'create a new connection con = New OleDb.OleDbConnection(strcon) con.Open() cmd.Connection = con cmd.CommandText = strselect dr = cmd.ExecuteReader If dr.Read Then If idTB.Text = dr("BorrowerId") Then MessageBox.Show("Valid Id") EditMember.Show() End If Else MessageBox.Show("Invalid Id") End If If idTB.Text = "" Then MessageBox.Show("Please Enter The BorrowerID") End If dr.Close() Catch eException As Exception MessageBox.Show(eException.Message) End Try End Sub -------- this 1 is where i wan the info to display out on the textboxes n combo box -------- Private Sub EditMember_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source =C:\Documents and Settings\Jasmine\My Documents\project\db1.mdb" Dim con As OleDb.OleDbConnection Dim dr As OleDb.OleDbDataReader Dim cmd As New OleDb.OleDbCommand Try Dim strselect As String = "Select Fname, Lname, Address1, Address2, Address3, ContactNo, HandPhNo, Email, CourseOfStudy from member where BorrowerId = '" & EditMemberLog.idTB.Text & "'" 'create a new connection con = New OleDb.OleDbConnection(strcon) con.Open()

    D 1 Reply Last reply
    0
    • K kyosugi

      1st, i check for a valid id for the user n if its valid, a new form will show the new form contains textboxes and a combo box i would wan the textboxes and the combo box to display the corresponding stuff from the database for exmaple name: my name address : my address the followin is the code i used -------- this 1 is which i validate the id, it works, but jus in case i wana know if the other code did not work because of it -------- Private Sub submitB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submitB.Click Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jasmine\My Documents\project\db1.mdb" Dim con As OleDb.OleDbConnection Dim dr As OleDb.OleDbDataReader Dim cmd As New OleDb.OleDbCommand Try Dim strselect As String = "Select BorrowerId from member where BorrowerId = '" & idTB.Text & "'" 'create a new connection con = New OleDb.OleDbConnection(strcon) con.Open() cmd.Connection = con cmd.CommandText = strselect dr = cmd.ExecuteReader If dr.Read Then If idTB.Text = dr("BorrowerId") Then MessageBox.Show("Valid Id") EditMember.Show() End If Else MessageBox.Show("Invalid Id") End If If idTB.Text = "" Then MessageBox.Show("Please Enter The BorrowerID") End If dr.Close() Catch eException As Exception MessageBox.Show(eException.Message) End Try End Sub -------- this 1 is where i wan the info to display out on the textboxes n combo box -------- Private Sub EditMember_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source =C:\Documents and Settings\Jasmine\My Documents\project\db1.mdb" Dim con As OleDb.OleDbConnection Dim dr As OleDb.OleDbDataReader Dim cmd As New OleDb.OleDbCommand Try Dim strselect As String = "Select Fname, Lname, Address1, Address2, Address3, ContactNo, HandPhNo, Email, CourseOfStudy from member where BorrowerId = '" & EditMemberLog.idTB.Text & "'" 'create a new connection con = New OleDb.OleDbConnection(strcon) con.Open()

      D Offline
      D Offline
      Dave Sexton
      wrote on last edited by
      #2

      Not exactly sure what your problem is... is it throwing you an exception? Not giving you the correct data? What?

      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