0

Hi guys can you help me out.
i want to display the item in my textbox but how can i do that
i tried to search tru web but nothings working for me.

it is something like this

"SELECT Department FROM Table1 WHERE Department = " & .Textbox1.Text & ""
textbox2.text = rs.fields(1)
textbox3.text = rs.fields(2)

it will display the data it find to my textbox

3
Contributors
4
Replies
31
Views
3 Years
Discussion Span
Last Post by Reverend Jim
0

why are you selecting Department when you already know what it is... I think you mean something like
SELECT * FROM Table1 WHERE Department = "'" + Textbox1.Text + "'". You should replace the * with the columns you want returned.

0

I liked to use Oledb and i want to put the data it find in a textbox

con.open
SELECT * FROM Table1 WHERE Department = "'"
'and if the search is true it will place the data in textbox
textbox1.text = rs!fields(1)
textbox2.text = rs!fields(2)
textbox3.text = rs!fields(3)

something like that..

0

Try

Dim cmd As New OleDbCommand("", con)

cmd.CommandText = "SELECT * FROM Table1 WHERE Department = ?"
cmd.Parameters.AddWithValue("@dept", txtDept.Text)

con.Open()
Dim rdr As OleDbDataReader = cmd.ExecuteReader()

If rdr.Read Then
    TextBox1.Text = rdr.GetString(0)
    TextBox1.Text = rdr.GetString(1)
    TextBox1.Text = rdr.GetString(2)
End If

rdr.Close()
con.Close()
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.