Hi guys,
basically i have a form with textboxes such as
First name
phone number
and each row has an auto number assigned to it.
that auto number is the customers reference number.
basically i want to be able to enter a reference number into a text box and when a button is clicked i want to extract all the name and phone number from the database and put them into the relevant text boxes.
how would i go about doing this?

this is essentially a search and output problem



Select * from Customer where customerreferene number='Pass the reference number'.
Fill the data set with the records, loop through all the records and assign the values to the respective textboxes.

my code at the moment is

            cmd = New OleDb.OleDbCommand("SELECT * FROM login where Reference='" & txtReference.Text & "' ", connection)
            datareader = cmd.ExecuteReader()
            If datareader.Read() Then

                txtSurname.Text = datareader("Surname")

                txtSurname.Text = ""
                MessageBox.Show("No Information  found")
            End If
        Catch ex As OleDb.OleDbException
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Oledb Error")
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "General Error")
        End Try

but it says i dont have the right parameters. any ideas? (oledb error)

Edited 5 Years Ago by rosstafarian: n/a

Right guys its all fixed
stupidly tried to read from the wrong table and then the two apostrophes (') in the sql string turned it into a string, which obviously isnt an integer. but all sorted now.

any ideas how i could write a bit of code that over writes a row with updated information?

This article has been dead for over six months. Start a new discussion instead.