日期:2014-05-18 浏览次数:20430 次
<BaseInfo> <TransType>U</TransType> <TransCode>01011001</TransCode> <HeaderVervsion /> <SubTransCode /> <TransDate>2011-06-16</TransDate> <TransTime>00:00:00</TransTime> <TransSeq /> <Operator>001</Operator> <TotalRowNum /> <RowNumStart /> <ResultCode>0</ResultCode> <ResultMsg /> <CltSysCode>13</CltSysCode> <ClinetIp /> <MachineNo /> <OperatorCom>86</OperatorCom> <SvrSysCode /> <RouteKey1 /> <RouteKey2 /> <RouteKey3 /> <RegCertifId /> <TransEndDATE /> <TransEndTime /> <ValConstrLimit1 /> <ValConstrLimit2 /> <GranterNo /> <GranterPwd /> <BS_NO /> <EXT_KEY1 /> <EXT_KEY2 /> <EXT_KEY3 /> - <Input> - <Base> <GUID>NCIA30888664887549x</GUID> <ManageCom>86210000</ManageCom> <PayMode /> <HighAmntFlag /> <HealthImpartFlag /> <OccpuImpartFlag /> <FinImpartFlag /> </Base> </Input> </BaseInfo>
string sqlBaseInfo = "select * from BaseInfo where BaseInfo_Id = 14"; dt = DBHelper.getDataTable(sqlBaseInfo, null); dt.TableName = "BaseInfo"; ds.Tables.Add(dt.Copy()); //---------------------- string sqlInput = "select * from Input where BaseInfo_Id = 14"; DataTable dtInput = DBHelper.getDataTable(sqlInput, null); dtInput.TableName = "Input"; string Input_Id = dtInput.Rows[0]["Input_Id"].ToString(); ds.Tables.Add(dtInput.Copy()); //--------------------- string sqlBase = "select * from Base where Input_Id = " + Input_Id + ""; dt = DBHelper.getDataTable(sqlBase, null); dt.TableName = "Base"; ds.Tables.Add(dt.Copy()); DataRelation custOrderRelation = ds.Relations.Add("Input-Base", ds.Tables["Input"].Columns["Input_Id"], ds.Tables["Base"].Columns["Input_Id"]); DataRelation custOrderRelation1 = ds.Relations.Add("BaseInfo-Input", ds.Tables["BaseInfo"].Columns["BaseInfo_Id"], ds.Tables["Input"].Columns["BaseInfo_Id"]);
public static bool CDataToXmlFile(DataTable dt, string xmlFilePath) { if ((dt != null) && (!string.IsNullOrEmpty(xmlFilePath))) { // string path = HttpContext.Current.Server.MapPath(xmlFilePath); string path = xmlFilePath; MemoryStream ms = null; XmlTextWriter XmlWt = null; try { ms = new MemoryStream(); //根据ms实例化XmlWt XmlWt = new XmlTextWriter(ms, Encoding.Unicode); //获取ds中的数据 dt.WriteXml(XmlWt); int count = (int)ms.Length; byte[] temp = new byte[count]; ms.Seek(0, SeekOrigin.Begin); ms.Read(temp, 0, count); //返回Unicode编码的文本 UnicodeEncoding ucode = new UnicodeEncoding(); //写文件 StreamWriter sw = new StreamWriter(path);