|
 |
aspx_beginners thread: WriteXml ...group and 1st item get the same name.
Message #1 by "Abby Lee" <abbylee26@h...> on Thu, 13 Mar 2003 21:32:49
|
|
I create a file called "fein.xml" from a
Access DB called "fein.mdb"
The DB has a single table called "vendfein"
1st field of the table is "fein"
2nd field of table is "company"
my .aspx
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="C#" runat="server">
void xmlFunction(object sender, EventArgs e) {
string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
strConnection += @"Data Source=c:/BegASPNET/MakeFEIN/fein.mdb";
data_src.Text = strConnection;
string strSQL = "SELECT * from vendfein";
DataSet objDataSet = new DataSet();
OleDbConnection objConnection = new OleDbConnection(strConnection);
OleDbDataAdapter objAdapter = new OleDbDataAdapter(strSQL,
objConnection);
string strVal;
objAdapter.Fill(objDataSet, "fein");
objDataSet.WriteXml(Server.MapPath("fein.xml"));
It creates the nicest little xml
Trouble is...each group is called "fein" and the first item in each group
is also "fein"...this really screws up some of my non aspx.net scripts.
the xml looks like
<?xml version ="1.0" standalone="yes"?>
<NewDataSet>
<fein>
<fein>13-3456234</fein>
<company>McDonnalds</company>
<phone>555-5555</phone>
</fein>
</NewDataSet>
How can I tell my program that creates the xml that I don't want the group
called the same thing as the first item?
Message #2 by "Abby Lee" <abbylee26@h...> on Thu, 13 Mar 2003 21:54:49
|
|
I guess I just need to know how to create an .xml without the main
grouping taking on the same name as the 1st item.
> I create a file called "fein.xml" from a
A> ccess DB called "fein.mdb"
T> he DB has a single table called "vendfein"
1> st field of the table is "fein"
2> nd field of table is "company"
> my .aspx
<> %@ Page Language="C#" Debug="true" %>
<> %@ Import Namespace="System.Data" %>
<> %@ Import Namespace="System.Data.OleDb" %>
> <script language="C#" runat="server">
v> oid xmlFunction(object sender, EventArgs e) {
> string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";
> strConnection += @"Data Source=c:/BegASPNET/MakeFEIN/fein.mdb";
> data_src.Text = strConnection;
> string strSQL = "SELECT * from vendfein";
> DataSet objDataSet = new DataSet();
> OleDbConnection objConnection = new OleDbConnection(strConnection);
> OleDbDataAdapter objAdapter = new OleDbDataAdapter(strSQL,
o> bjConnection);
> string strVal;
> objAdapter.Fill(objDataSet, "fein");
> objDataSet.WriteXml(Server.MapPath("fein.xml"));
>
I> t creates the nicest little xml
T> rouble is...each group is called "fein" and the first item in each
group
i> s also "fein"...this really screws up some of my non aspx.net scripts.
> the xml looks like
> <?xml version ="1.0" standalone="yes"?>
<> NewDataSet>
> <fein>
> <fein>13-3456234</fein>
> <company>McDonnalds</company>
> <phone>555-5555</phone>
> </fein>
<> /NewDataSet>
> How can I tell my program that creates the xml that I don't want the
group
c> alled the same thing as the first item?
|
|
 |