No se ve mi Data Grid!!
Publicado por Lupita (78 intervenciones) el 26/07/2006 19:07:53
Hola!!
He realizado un web service ke me obtenga datos de la tabla de northwind de sql, he conseguido ke los datos se muestren en un textbox, pero no he conseguido ke pase lo mismo con un datagrid, no me manda ningún error al realizar el evento, pero el data grid, no se ve en la pantalla, alguien podria decirme ke debo hacer.
De antemano muchas gracias...
Dejo el coodigo para ke me digan en donde esta mi error!!
private void Button1_Click(object sender, System.EventArgs e)
{
// Create a proxy object that is ready to invoke the XML Web service method.
localhost.conex svc = new localhost.conex ();
// Invoke the XML Web service method to get Products data in XML format.
string strXml = svc.GetProductsData();
// Display XML data in the text box to show what it looks like.
esc.Text = strXml;
// Read the XML data into the local DataSet.
System.IO.StringReader sr = new System.IO.StringReader(strXml);
productsDataSet2.ReadXml(sr);
productsDataSet2.AcceptChanges();
// Bind the DataGrid to the DataSet to display the data.
datagrid1.DataSource = productsDataSet2.Tables[0].DefaultView;
datagrid1.Visible =true;
}
He realizado un web service ke me obtenga datos de la tabla de northwind de sql, he conseguido ke los datos se muestren en un textbox, pero no he conseguido ke pase lo mismo con un datagrid, no me manda ningún error al realizar el evento, pero el data grid, no se ve en la pantalla, alguien podria decirme ke debo hacer.
De antemano muchas gracias...
Dejo el coodigo para ke me digan en donde esta mi error!!
private void Button1_Click(object sender, System.EventArgs e)
{
// Create a proxy object that is ready to invoke the XML Web service method.
localhost.conex svc = new localhost.conex ();
// Invoke the XML Web service method to get Products data in XML format.
string strXml = svc.GetProductsData();
// Display XML data in the text box to show what it looks like.
esc.Text = strXml;
// Read the XML data into the local DataSet.
System.IO.StringReader sr = new System.IO.StringReader(strXml);
productsDataSet2.ReadXml(sr);
productsDataSet2.AcceptChanges();
// Bind the DataGrid to the DataSet to display the data.
datagrid1.DataSource = productsDataSet2.Tables[0].DefaultView;
datagrid1.Visible =true;
}
Valora esta pregunta


0