K
Karl Beigan via .NET 247
Help Me please,
I'm in the process of putting together an application that willstream video into WMP (SDK version 9), based on a a userselection via a Winform datagrid. I'm using theSqlHelper.FillDataset fuction to fill a strongly typed dataset.However the problem has arrised, the the Datagrid is not beingpopulated with the datacontained within the dataset, thought thecolumns are updated to reflex it's structure. Dispite confirmingthat data is contained with the DS via using Dataset.getxml() toan textbox. Please see my code below.
Any Ideas why the datagrid doesn't see the data?
private void Form2_Load(object sender, System.EventArgs e)
{
// create a sqlconnection oject for the sqlhelper
SqlConnection DBcon = newSqlConnection(ConfigurationSettings.AppSettings["ConnectionString1"]);
try
{
DBcon.Open(); // test connection
// stored procedure name
String spEmp = "Employee";
SqlParameter [] TypeParam = new SqlParameter[0];
//connection to datasource
SqlHelper.FillDataset(DBcon,spEmp, northwind1,new string[]{"Employees"},TypeParam);
// populate textbox with ds to confirm DS has data
textBox1.Text = northwind1.GetXml();
//bind data to datagrid
dataGrid1.DataSource = northwind1.spTest123;
}
catch (SqlException ex)
{
MessageBox.Show("Can't connect to the db because, " +ex.Message);
}
}
I'm in the process of putting together an application that willstream video into WMP (SDK version 9), based on a a userselection via a Winform datagrid. I'm using theSqlHelper.FillDataset fuction to fill a strongly typed dataset.However the problem has arrised, the the Datagrid is not beingpopulated with the datacontained within the dataset, thought thecolumns are updated to reflex it's structure. Dispite confirmingthat data is contained with the DS via using Dataset.getxml() toan textbox. Please see my code below.
Any Ideas why the datagrid doesn't see the data?
private void Form2_Load(object sender, System.EventArgs e)
{
// create a sqlconnection oject for the sqlhelper
SqlConnection DBcon = newSqlConnection(ConfigurationSettings.AppSettings["ConnectionString1"]);
try
{
DBcon.Open(); // test connection
// stored procedure name
String spEmp = "Employee";
SqlParameter [] TypeParam = new SqlParameter[0];
//connection to datasource
SqlHelper.FillDataset(DBcon,spEmp, northwind1,new string[]{"Employees"},TypeParam);
// populate textbox with ds to confirm DS has data
textBox1.Text = northwind1.GetXml();
//bind data to datagrid
dataGrid1.DataSource = northwind1.spTest123;
}
catch (SqlException ex)
{
MessageBox.Show("Can't connect to the db because, " +ex.Message);
}
}