General information
Category:
The Mere Mortals .NET Framework
Title:
Dataset has data, but datagrid is not showing any rows
Hi,
I am using a business object "MyBusinessObject" that contains several methods that return datasets. One of those methods uses an Sql statement that includes a UNION between two tables and each of those tables also have one INNER JOIN with another table. Testing the Sql statement separately in Query Analyzer results in several rows being returned.
In the business object method, after defining the Sql statement, the dataset is filled by using the following code (I am using GetDataSet overload #11):
DataSet dsMyDataSet = this.GetDataSet(this.Sql, "MyTableName",
this.CreateParameter("@MyParameter", myParameter));
return dsMyDataSet;
The datagrid that needs to show the data in dsMyDataSet has its properties set as follows:
BindingSource: MyBusinessObject
BindingSourceMember: MyTableName
BindingSourceType: Default
BindingType: OneWay
When I run the application in debug mode, I can see that dsMyDataSet is filled with rows and columns. However, the datagrid does not show any data.
The MM.Net Developer Guide states the following:
"If you don't specify any other binding properties, the DataGrid is bound to the business object's default DataTable (specified in the business object's TableName) property. If you want to bind the DataGrid to a different table, specify the table name in the DataGrid's BindingSourceMember property."
I am assuming that using GetDataSet overload# 11, which sets the tablename, would do the trick. What is missing or what am I doing wrong?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only