this is my select query, i was able to retrieve in a textbox. but when i updating, it updates all of its record in first column and i know that the reason is the 'ExecuteScalar', so anyone knows what should i replace in this? because i only want to update first row in a column?
Dim fname As New SqlCommand
Dim lname As New SqlCommand
Dim CMD As New SqlCommand
con = New SqlConnection("server=;uid=admin;pwd=t;database=")
con.Open()
fname = New SqlCommand("select first_name from employee_info where employee_id='" & TextBox1.Text & "';", con)
lname = New SqlCommand("select last_name from employee_info where employee_id='" & TextBox1.Text & "';", con)
CMD.Connection = con
TextBox3.Text = fname.ExecuteScalar
fname.ExecuteNonQuery()
TextBox4.Text = lname.ExecuteScalar
lname.ExecuteNonQuery()
by the way this is my update query....
fname = New SqlCommand("UPDATE employee_info SET first_name= '" & TextBox3.Text & "';", con)
fname.Connection = con
fname.ExecuteNonQuery()
lname = New SqlCommand("UPDATE employee_info SET last_name= '" & TextBox4.Text & "';", con)
lname.Connection = con
lname.ExecuteNonQuery()