G
Guest
Dear All
I need some help. I've got a deadline for this friday and i'm stuck. what
i'm trying to do is have 1 textbox, datagrid and 1 button then when the user
enter a search string, and press the button, I want the result to be
displayed in the datagrid.
At the moment, when the user press the button the system checks if there is
any text in the text box, if there isn’t then it calls the BindDataGrid2()
function which displays everything that’s in the table .
So basically I’m not able to use the value that is in the textbox to make a
custom query.
Please help me
Thank you
Dan
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim mun As String
Dim textBinding As String
Dim Mark As String
' filter = TextBox1.Text
If TextBox1.Text = "" Then
BindDataGrid2()
' DataGrid2.Visible = False
Else
textBinding = TextBox1.Text
Dim strSQL As String = _
"SELECT * FROM ChangeLog where ChangeDetails = 'textBinding'"
With DataGrid2
' Set the DataKeyField so that the DataKeys collection is
filled and
' usable in the ItemCommand event handler. See further
comments in
' grdCustomers_ItemCommand(), above.
.DataKeyField = "ChangeID"
.DataSource = CreateDataSet(strSQL)
.DataBind()
End With
End If
End Sub
' This routine calls CreateDataSet and binds the Customers DataGrid to
the
' return value.
' This routine calls CreateDataSet and binds the Customers DataGrid to
the
' return value.
Sub BindDataGrid2()
Dim textBinding As String
Dim mun As String
textBinding = TextBox1.Text
' textBinding = pete
Dim strSQL As String = _
"SELECT * FROM ChangeLog "
'where ChangeDetails = mun"
With DataGrid2
' Set the DataKeyField so that the DataKeys collection is filled
and
' usable in the ItemCommand event handler. See further comments
in
' grdCustomers_ItemCommand(), above.
.DataKeyField = "ChangeID"
.DataSource = CreateDataSet(strSQL)
.DataBind()
End With
End Sub
I need some help. I've got a deadline for this friday and i'm stuck. what
i'm trying to do is have 1 textbox, datagrid and 1 button then when the user
enter a search string, and press the button, I want the result to be
displayed in the datagrid.
At the moment, when the user press the button the system checks if there is
any text in the text box, if there isn’t then it calls the BindDataGrid2()
function which displays everything that’s in the table .
So basically I’m not able to use the value that is in the textbox to make a
custom query.
Please help me
Thank you
Dan
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim mun As String
Dim textBinding As String
Dim Mark As String
' filter = TextBox1.Text
If TextBox1.Text = "" Then
BindDataGrid2()
' DataGrid2.Visible = False
Else
textBinding = TextBox1.Text
Dim strSQL As String = _
"SELECT * FROM ChangeLog where ChangeDetails = 'textBinding'"
With DataGrid2
' Set the DataKeyField so that the DataKeys collection is
filled and
' usable in the ItemCommand event handler. See further
comments in
' grdCustomers_ItemCommand(), above.
.DataKeyField = "ChangeID"
.DataSource = CreateDataSet(strSQL)
.DataBind()
End With
End If
End Sub
' This routine calls CreateDataSet and binds the Customers DataGrid to
the
' return value.
' This routine calls CreateDataSet and binds the Customers DataGrid to
the
' return value.
Sub BindDataGrid2()
Dim textBinding As String
Dim mun As String
textBinding = TextBox1.Text
' textBinding = pete
Dim strSQL As String = _
"SELECT * FROM ChangeLog "
'where ChangeDetails = mun"
With DataGrid2
' Set the DataKeyField so that the DataKeys collection is filled
and
' usable in the ItemCommand event handler. See further comments
in
' grdCustomers_ItemCommand(), above.
.DataKeyField = "ChangeID"
.DataSource = CreateDataSet(strSQL)
.DataBind()
End With
End Sub