apologies first if there is an answer to my query on this forum somewhere. i have searched but the results have either been too confusing for me to understand or have not applied to my situation.
I have an SQL select statement which is generated by items in a list box using this code:
it is a basic sql string which looks like:
i need to bind the results to a datagrid and understand that using datasets and datatables is the way to do this.
I can create these manually using the designer, but in this instance the number of columns etc in the result set can change.
so the question is - how do i programmically create a dataset, add a datatable and fill it using a string as the sql command?
please help.
Paul
I have an SQL select statement which is generated by items in a list box using this code:
VB.NET:
mystring = Nothing
myindex = Nothing
lstcriteria.SelectedIndex = 0
Do Until myindex = lstprecincts.Items.Count
lstprecincts.SelectedIndex = myindex
mystring = mystring & " " & lstcriteria.Text
myindex = myindex + 1
Loop
it is a basic sql string which looks like:
VB.NET:
select x from a where b=c
i need to bind the results to a datagrid and understand that using datasets and datatables is the way to do this.
I can create these manually using the designer, but in this instance the number of columns etc in the result set can change.
so the question is - how do i programmically create a dataset, add a datatable and fill it using a string as the sql command?
please help.
Paul