Populate ComboBox From SQL Query
I am trying to populate a ComboBox from the result of a stored procedure. The stored procedure simply returns the distinct values of a single column from a table. I believe I am making a connection to the database and returning dataset. My problem occurs while trying to use the dataset as the source for the combobox. The error I get is "Cannot serialize the DataTable. DataTable name is not set'. Where and how do I do this?
Could someone help me with this?
Thanks,
Robert
-
SQLQuery returns a Results which type is DataTable.
Results
The results of the query as a DataTable.
if you assign the Results as a variable named as 'dt'.
Use Assign activity: dt.TableName = 'Any name'
http://msdn.microsoft.com/en-us/library/system.data.datatable.tablename.aspx
0 -
That worked.
What I did was to add an Assign tool between the SqlQuery and DataTableToDataItemList tools.
I set the datatable name like this dtResults.TableName = "foo"
Then set the dtResults to variable iDataItems in the DataTableToDataItemList.
Finally bind the ComboBox to iDataItems.
Thanks,
Robert
0 -
Robert, I realize this was a very long time ago, but I am having trouble with that last step, to bind the combo box to the DataItemList. I have a runtime process which creates a combobox on the fly and populates the list from the results of a SQL query. I have created the DataItemList from the SQL query results, but I can't figure out how to set the combobox to use the dataitemlist. 0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
3 Kommentare