0

how to display result from data base into textbox and if the result exceed 1 key up and down to preview

 con = New SqlConnection(cs)
con.Open()
Dim sql As String = " Select RTRIM(visit.regdate),RTRIM(Patientno) from visit where visit.accno =@d6 "
cmd = New SqlCommand(sql, con)
cmd.Parameters.AddWithValue("d6", accno.Text)
rdr = cmd.ExecuteReader()

While (rdr.Read() = True)

    regdate.Value = rdr.GetValue(0)
    patientno.Text = rdr.GetValue(1)

End While
3
  • It is unclear what you are asking. What results do you want, or what problem do you have? What have you tried? Commented Jul 17, 2017 at 17:38
  • when user enter visit no into textbox the system retrieve the last record only , the problem is that i want to change between records Commented Jul 18, 2017 at 10:52
  • You should Edit your question and add requested details to the body of the question. Commented Jul 18, 2017 at 14:14

1 Answer 1

1

You must use listbox instead textbox to put your data, here is an example:

ListBox1.ColumnCount = 3 
ListBox1.Columnwidths = "100,100,100" 
ListBox1.AddListItem("row1 col1", 1,1) 
ListBox1.AddListItem("row1 col2", 1,2)
ListBox1.AddListItem("row2 col2", 2,2)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.