i have a set of data which have two field (ID and Title).
i have two textbox and 1 button.
after i key in "data of Title field" in textbox1 and click the commandbutton, i want the match "ID data" show in textbox2.
How to do that?
Printable View
i have a set of data which have two field (ID and Title).
i have two textbox and 1 button.
after i key in "data of Title field" in textbox1 and click the commandbutton, i want the match "ID data" show in textbox2.
How to do that?
In brief you'd do
'connect to DB
'issue oledbcommand
because you only want to return 1 value you can use executeScalar with a select statement like (SELECT id FROM yourTable WHERE title = '@title')
'add parameter > commandName.parameter.addwithvalue("@title", textbox1.text)
'execute command
dim theID as string = commandName.executeScalar()
textBox2.text = theID
If you are unsure of the code that accomplishes this I'd suggest studing ADO.NET