Very well I have a form, a table, a button and a text box, the table appears empty apparently does not look for the data, (Pd the query manually if fucniona), but I guess my error is in the query , but I'm not sure ...
hc.aspx
<asp:TextBox CssClass="form-control" ID="txt_clave_curso" name="clave_curso" runat="server" ReadOnly="false" Text=""></asp:TextBox>
<asp:Button ID="btn_search" name="btn_search" runat="server" Text=" Aplicar " CausesValidation="true" CssClass="btn btn-warning btn-sm" Width="140px" />
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn_search" EventName="Click"/>
</Triggers>
The previous trigger updates the table with the data when I press the button ..
vb.hc.aspx Here the BD part begins
Protected Sub rg_hhc_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles rg_hhc.NeedDataSource
Dim dbConn As MySqlConnection
Dim dbComm As MySqlCommand
Dim dbAdapt As MySqlDataAdapter
Dim connStr As String = Nothing
Dim sqlQuery As String = Nothing
Dim table As New DataTable
Dim buscarclave As String = txt_clave_curso.Text
//Aqui quiero tomar lo que tiene la caja de texto para buscarlo en la consulta
connStr = ConfigurationManager.ConnectionStrings("X").ConnectionString
dbConn = New MySqlConnection(connStr)
dbConn.Open()
Summary part of the query, in the end I have a LIKE that does not work for me to search ...
sqlQuery = sqlQuery & " where b.fecha_ef>='2018-09-01' and b.fecha_ef<='2018-09-30' and a.Id_org='PNGR' and a.Id_detalle>0 and c.Idcurso like '%'" + buscarclave + "'%'"
sqlQuery = sqlQuery & " group by a.Idlista"
dbComm = New MySqlCommand(sqlQuery, dbConn)
//Aqui en dboParameters no se si lo lleva o no
dbComm.Parameters.AddWithValue("Idcurso", buscarclave)
dbAdapt = New MySqlDataAdapter(dbComm)
dbAdapt.Fill(table)
dbConn.Close()
dbConn.Dispose()
rg_hhc.DataSource = table
table.Dispose()
End Sub