I
IR
I have pretty big table - around 100 fields. But I need to load into DataSet
just few of them.
I am trying to use XML schema for this purpose.
XSDSchema1.xsd contains schema for this table with these several fields I
actually need.
I am using the following code to populate dataset:
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM SomeTable", Cnn);
DataSet ds = new DataSet();
ds.ReadXmlSchema (Server.MapPath(_Server_Root)+ "Test1\\XSDSchema1.xsd");
da.Fill(ds, "SomeTable");
dgr.DataSource = ds.Tables[0]; // dgr - data grid component
if (!IsPostBack) {
dgr.DataBind();
}
The problem is, I am getting ALL fields from "SomeTable" table, instead of
several of them specified in XSDSchema1.xsd.
Specifying these fields in SqlDataAdapter constructor, like this
SqlDataAdapter da = new SqlDataAdapter("SELECT f1, f2, f3, f4, f5 FROM
SomeTable", Cnn);
is not solution - I need to be able control list of displayable fields by
editing XSDSchema1.xsd.
Is there any way to solve this problem?
Your help will be very much appreciated.
Igor
just few of them.
I am trying to use XML schema for this purpose.
XSDSchema1.xsd contains schema for this table with these several fields I
actually need.
I am using the following code to populate dataset:
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM SomeTable", Cnn);
DataSet ds = new DataSet();
ds.ReadXmlSchema (Server.MapPath(_Server_Root)+ "Test1\\XSDSchema1.xsd");
da.Fill(ds, "SomeTable");
dgr.DataSource = ds.Tables[0]; // dgr - data grid component
if (!IsPostBack) {
dgr.DataBind();
}
The problem is, I am getting ALL fields from "SomeTable" table, instead of
several of them specified in XSDSchema1.xsd.
Specifying these fields in SqlDataAdapter constructor, like this
SqlDataAdapter da = new SqlDataAdapter("SELECT f1, f2, f3, f4, f5 FROM
SomeTable", Cnn);
is not solution - I need to be able control list of displayable fields by
editing XSDSchema1.xsd.
Is there any way to solve this problem?
Your help will be very much appreciated.
Igor