i am trying to do a search in datagrid using variables i made a search text box here is the code
Dim srch As Integer
Dim coltotal As Short
coltotal = DataGridView1.Columns.Count - 2
For srch = 0 To coltotal
Dim item As String = DataGridView1.Columns(srch).HeaderText
Dim mysql As String = "Select * from [" & DBCreaTor.CmbDB.Text & "].[dbo].[" & cmbtbl.Text & "] where [" & item & "] like '%" & TextBox1.Text.Trim & "%'"
Dim dt3 As New DataTable
adp = New SqlDataAdapter(mysql, con)
adp.Fill(dt3)
DataGridView1.DataSource = dt3
next
the search is not showing anything though on sql management studio it returns result i dont know what is it that am not knowing or adding please help

New Topic/Question
Reply



MultiQuote



yes it is all on same pc and same db, but i am thinking maybe the string is not filling the datatable ( dt3) correctly i.e lets say it finds the search then in the next ( NEXT) it fills another dt3 which has no result let me show you the pic of the table just for testing with random everything


|