0

Hai....
Im new to .net ,I need help in doing my project....
If i Give the lastname in textbox then the items in lastname should be displayed in the anthor textbox
For ex :
Thomus,123,aaa
Thomus,345,bbb
H_alert,456,ccc

If i enter thomus it should show all thomus from my database but its not working...only one item is displaying in the textbox....
fro ex:
thomus,123,aaa

I set textbox mode as multiple line

please help me ...what to do...
i used this code its showing only one item....

mycon.Open()
        Dim myCmd As New SqlCommand
        myCmd.CommandText = "SELECT * FROM agent where Lastname='" & Me.TextBox2.Text.Trim() & "'"
        myCmd.Connection = mycon
        Dim i As Integer
        Try
            Dim y As SqlDataReader
            y = myCmd.ExecuteReader()
            i = 0
            While y.Read
                TextBox9.Text = (y.GetValue(1) & vbCrLf & y.GetValue(3) & vbCrLf & y.GetValue(2))          
  End While
            y.Close()
        Catch ex As Exception
            Label1.Text = ex.Message
        Finally

            mycon.Close()
            myCmd.Dispose()
        End Try

thanks in advance...
:(

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by yookify
0

Hi Yookify
Try This
Replace This line
TextBox9.Text = (y.GetValue(1) & vbCrLf & y.GetValue(3) & vbCrLf & y.GetValue(2))

By This
TextBox9.Text = TextBox9.Text & (y.GetValue(1) & "," & y.GetValue(3) & "," & y.GetValue(2) & vbCrLf )

Hope You get what you asked

0

Hi Yookify
Try This
Replace This line
TextBox9.Text = (y.GetValue(1) & vbCrLf & y.GetValue(3) & vbCrLf & y.GetValue(2))

By This
TextBox9.Text = TextBox9.Text & (y.GetValue(1) & "," & y.GetValue(3) & "," & y.GetValue(2) & vbCrLf )

Hope You get what you asked

I cant Believe it yar....I tried a lot used more codings but i cant get answ...
now im so happy ...Thak you ....Its very very smiple...Oh Thanks yar Really Thanks A Lot :):-O:P

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.