S
Steven Smith
Hi guys
What I'm trying to do today is display the results from
an SQL query on one table in a Datagrid I'm using the
following code to query the table.
\\\
Try
If txtCustomersIDOrders.Text <> "" Then
DataSetCustomersOrders.Clear()
OleDbDataAdapterCustomersOrders.SelectCommand.CommandText
= "SELECT * FROM Orders WHERE " & "[Customer ID] = '" &
txtCustomersIDOrders.Text & "' "
OleDbDataAdapterCustomersOrders.Fill
(DataSetCustomersOrders)
Else
txtCustomersIDOrders.Text = "Enter users ID here"
End If
Catch oledbExceptionparameter As
System.Data.OleDb.OleDbException
Catch invalidoperationexceptionparameter As
InvalidOperationException
End Try
///
The datagrid is bound to the 'DataSetCustomersOrders'
DataSet and a TextBox is being used to feed the WHERE
clause in the SQL statement I also know for sure that
records meeting the criteria exist but no results are
being displayed in the grid when I hit my command button
to trigger the event.
I know I could do this easily using a DataView / Filter
but I would really like to get it working through SQL for
my own benefit
Thanks in advance
Regards Steve
What I'm trying to do today is display the results from
an SQL query on one table in a Datagrid I'm using the
following code to query the table.
\\\
Try
If txtCustomersIDOrders.Text <> "" Then
DataSetCustomersOrders.Clear()
OleDbDataAdapterCustomersOrders.SelectCommand.CommandText
= "SELECT * FROM Orders WHERE " & "[Customer ID] = '" &
txtCustomersIDOrders.Text & "' "
OleDbDataAdapterCustomersOrders.Fill
(DataSetCustomersOrders)
Else
txtCustomersIDOrders.Text = "Enter users ID here"
End If
Catch oledbExceptionparameter As
System.Data.OleDb.OleDbException
Catch invalidoperationexceptionparameter As
InvalidOperationException
End Try
///
The datagrid is bound to the 'DataSetCustomersOrders'
DataSet and a TextBox is being used to feed the WHERE
clause in the SQL statement I also know for sure that
records meeting the criteria exist but no results are
being displayed in the grid when I hit my command button
to trigger the event.
I know I could do this easily using a DataView / Filter
but I would really like to get it working through SQL for
my own benefit
Thanks in advance
Regards Steve