Hi guys,
basically i have a form with textboxes such as
First name
surname
phone number
in.
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


Thanks

Ross

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

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

                txtSurname.Text = datareader("Surname")

            Else
                txtSurname.Text = ""
                MessageBox.Show("No Information  found")
            End If
            connection.Close()
        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)

which data base ur using?

Can you show all the code? Then I can take a look at this problem.

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?

Then plz mark the thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.