issue in datagridview search

  • Thread starter Thread starter Omi4u
  • Start date Start date
O

Omi4u

Guest
dear all i have a datagridview with 5 columns

whenever i use below code to retrive data using textbox,it retrive data with column name. i need data under my columns

my code are


Private Function PopulateDataGridView() As DataTable
Dim query As String = "SELECT documentno, documenttype, documentname,expirydate,attachment FROM documentattachment"
query &= " WHERE supplierid LIKE '%' + @supplierid + '%'"
query &= " OR @supplierid = ''"
Dim constr As String = appx.myconnection
Using con As SqlConnection = New SqlConnection(constr)
Using cmd As SqlCommand = New SqlCommand(query, con)
cmd.Parameters.AddWithValue("@supplierid", SupplieridTextBox1.Text.Trim())
Using sda As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dt As DataTable = New DataTable()
sda.Fill(dt)
Return dt
End Using
End Using
End Using
End Function


Private Sub SupplieridTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SupplieridTextBox1.TextChanged
DataGridView1.DataSource = Me.PopulateDataGridView()


End Sub


Please help

Continue reading...
 
Back
Top