本文整理汇总了C#中System.Data.DataSet.WriteXml方法的典型用法代码示例。如果您正苦于以下问题:C# System.Data.DataSet.WriteXml方法的具体用法?C# System.Data.DataSet.WriteXml怎么用?C# System.Data.DataSet.WriteXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataSet
的用法示例。
在下文中一共展示了System.Data.DataSet.WriteXml方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
internal static void Process (List<string> assemblies, string outputPath)
{
List<string> valid_config_files = new List<string> ();
foreach (string assembly in assemblies) {
string assemblyConfig = assembly + ".config";
if (File.Exists (assemblyConfig)) {
XmlDocument doc = new XmlDocument ();
try {
doc.Load (assemblyConfig);
} catch (XmlException) {
doc = null;
}
if (doc != null)
valid_config_files.Add (assemblyConfig);
}
}
if (valid_config_files.Count == 0)
return;
string first_file = valid_config_files [0];
System.Data.DataSet dataset = new System.Data.DataSet ();
dataset.ReadXml (first_file);
valid_config_files.Remove (first_file);
foreach (string config_file in valid_config_files) {
System.Data.DataSet next_dataset = new System.Data.DataSet ();
next_dataset.ReadXml (config_file);
dataset.Merge (next_dataset);
}
dataset.WriteXml (outputPath + ".config");
}
示例2: Process
internal static void Process(ILRepack repack)
{
try
{
var validConfigFiles = new List<string>();
foreach (string assembly in repack.MergedAssemblyFiles)
{
string assemblyConfig = assembly + ".config";
if (File.Exists(assemblyConfig))
{
var doc = new XmlDocument();
doc.Load(assemblyConfig);
validConfigFiles.Add(assemblyConfig);
}
}
if (validConfigFiles.Count == 0)
return;
string firstFile = validConfigFiles[0];
var dataset = new System.Data.DataSet();
dataset.ReadXml(firstFile);
validConfigFiles.Remove(firstFile);
foreach (string configFile in validConfigFiles)
{
var nextDataset = new System.Data.DataSet();
nextDataset.ReadXml(configFile);
dataset.Merge(nextDataset);
}
dataset.WriteXml(repack.OutputFile + ".config");
}
catch (Exception e)
{
repack.ERROR("Failed to merge configuration files: " + e);
}
}
示例3: getData
public bool getData(string job, string rowIndex,string po,bool isEnBlanco)
{
bool outPut = false;
System.Data.DataSet DTS = null;
System.Data.SqlClient.SqlDataAdapter myDataAdapter = null;
SqlDataReader dr =null;
bool isStart = true;
int recNum = 0;
string _qtyShipped = null;
string _description = null;
int _componentNumber = 0;
string spacio = new string(' ', 17);
int myY = 555;
int myCopyY = 160;
string sql =
"SELECT P.PackageID, P.ShipmentNumber, P.Quantity, P.Weight, P.FreightCost, P.ShipMethod, P.ShipDate, P.ComponentNumber, P.StartNumber, " +
"P.EndNumber, P.TrackingNumber, P.NumberofPackages, S.JobNumber, S.ShipmentNumber, S.ShipName, S.ShipAddress1, S.ShipAddress2, S.ShipAddress3, " +
"S.ShipCountry, S.ShipCity, S.ShipState, S.ShipZip, S.ShipCountry, S.ShipContact, S.ShipPhone, S.ShipFax, S.ShipInNameOf, S.FOB, " +
"S.Instructions, OC.BackOrder as BackOrderShipment, SR.Description as SalesRepName, SV.Description as ShipDescription, OH.PONumber, " +
"OH.JobDescription, OC.Description as ComponentDescription, C.BillName, C.BillAddress1, C.BillAddress2, C.BillCity, C.BillState, C.BillZip, " +
"C.BillPhone, C.BillFax, C.BillContact, C.BillCountry, OQ.Quantity as OrderQuantity, OH.CustAccount, OH.CustName, OH.CustAddress1, " +
"OH.CustAddress2, OH.CustAddress3, OH.CustCity, OH.CustState, OH.CustZip, OH.CustPhone, OH.CustFax, OH.CustContact, OH.FormNumber, " +
"OH.OriginalJobNumber, OH.ReleaseNumber, P.Description as PackageDescription, OC.BackOrderQuantity as BackOrderQuantity, P.OddPackageQty, " +
"S.MShipInstructions, OH.PlantID, P.PostageCost, C.TermsCode, S.Residence, OH.DeliveryDate, S.Email, OH.CSR, P.TotalQtyShipped, OH.ProofDate, " +
"OH.ProofTime, OH.ProofDeliveryDate, P.ShipViaService, SS.Description as ShipingServiceDescription, OH.DistPO, OC.FinGoodCode, OH.OrderDate, " +
"S.ThirdPartyBilling, S.Shipped, S.SequenceNumber, P.OddPackageWeight " +
"FROM Package P INNER JOIN Shipment S ON P.ShipmentNumber = S.ShipmentNumber " +
"INNER JOIN OrderHeader OH ON S.JobNumber = OH.JobNumber " +
"INNER JOIN Customer C ON OH.CustAccount = C.Account " +
"LEFT JOIN OrderComponent OC ON P.JobNumber = OC.JobNumber AND ((P.ComponentNumber = OC.ComponentNumber) OR " +
"(P.ComponentNumber = 0 AND OC.ComponentNumber = 1)) LEFT JOIN OrderQtyTable OQ ON OC.JobNumber = OQ.JobNumber AND " +
"OC.ComponentNumber = OQ.ComponentNumber AND OC.QtyOrdIndex = OQ.QuantityLineNo " +
"LEFT JOIN SalesRep SR ON OH.SalesRepCode = SR.Code " +
"LEFT JOIN ShipVia SV ON P.ShipMethod = SV.Code " +
"LEFT JOIN ShipViaService SS ON P.ShipMethod = SS.ShipviaCode AND P.ShipViaService = SS.Code " +
"WHERE S.JobNumber = '" + job + "' and s.sequencenumber='" + rowIndex + "';";
string sqlGetConduceNum = "select max(ConduceNum) from tblConduce";
int conduceNum = 0;
string myPdfFile = null;
string pdfCopy = null;
if (po.Trim().Length > 0)
{
po += "-";
po +=myPdfFile;
myPdfFile = po;
}
pdfCopy = myPdfFile;
try
{
mySQlCnn();
myDataAdapter = new SqlDataAdapter();
myDataAdapter.TableMappings.Add("Table", "Table1");
DTS = new System.Data.DataSet("Table1");
sqlCmd.CommandType = System.Data.CommandType.Text;
sqlCmd.CommandText = sqlGetConduceNum;
conduceNum = (int) sqlCmd.ExecuteScalar();
conduceNum++;
if (!isEnBlanco)
{
sqlCmd.CommandText = sql;
myDataAdapter.SelectCommand = sqlCmd;
myDataAdapter.Fill(DTS);
DTS.WriteXml(@"prueba.xml");
dr = sqlCmd.ExecuteReader();
}
// crate el PDF
if (isEnBlanco)
{
job = "EnBlanco";
}
myPdfFile = GetRegistry.Registry.read("Software\\mop\\Conduce", "pdfPath");
myPdfFile += conduceNum + "-" + job + "-" + rowIndex + "-" + DateTime.Now.ToString("yyyMMdd") + ".pdf";
pdfCopy ="Copy_" + myPdfFile;
Document document = new Document(PageSize.LETTER);
Document Copydocument = new Document(PageSize.LETTER);
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(myPdfFile, FileMode.Create));
PdfWriter Copywriter = PdfWriter.GetInstance(document, new FileStream(pdfCopy, FileMode.Create));
document.Open();
Copydocument.Open();
// we grab the ContentByte and do some stuff with it
PdfContentByte cb = writer.DirectContent;
// para ver el pdf
System.Diagnostics.Process pr = new System.Diagnostics.Process();
pr.StartInfo.FileName = myPdfFile;
// Set font
BaseFont tahoma = BaseFont.CreateFont("tahoma.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
Font font = new Font(tahoma, 9, Font.NORMAL);
Font fontH = new Font(tahoma, 10, Font.BOLD);
//.........这里部分代码省略.........
示例4: writeXML
/// <summary>
/// дXML�ĵ�
/// </summary>
/// <param name="name">���ݿ������������</param>
/// <param name="con_str">���ݿ������Դ��Ϣ</param>
public void writeXML(string name , ConfigStruct con_str)
{
try
{
//����һ��dataset
System.Data.DataSet ds = new System.Data.DataSet("Autoconfig");
//�ж��Ƿ����config.xml�ļ�,������ڴӸ��ļ��ж�ȡ���ݵ�dataset
if(System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory.TrimEnd(new char[] {'\\'}) +"\\" +_FileName))
{
ds.ReadXml(AppDomain.CurrentDomain.BaseDirectory.TrimEnd(new char[] {'\\'}) +"\\" +_FileName);
}
//�ж��Ƿ���ڸñ�,���������ɾ���ñ�
if(ds.Tables.IndexOf(name.ToUpper()) != -1 )
{
ds.Tables.Remove(name.ToUpper());
}
//����һ��datatable
System.Data.DataTable dt = new System.Data.DataTable(name.ToUpper());
//Ϊ�¶���ı�������
dt.Columns.Add("key");
dt.Columns.Add("value");
SymmetricMethod sm = new SymmetricMethod();
//���Ӽ�¼���¶���ı���
dt.Rows.Add(new object[2]{ sm.Encrypto( str_HA ), sm.Encrypto( con_str.hostAddress)});
dt.Rows.Add(new object[2]{ sm.Encrypto( str_UN ), sm.Encrypto( con_str.userName)});
dt.Rows.Add(new object[2]{ sm.Encrypto( str_PWD ), sm.Encrypto( con_str.password)});
dt.Rows.Add(new object[2]{ sm.Encrypto( str_DBN ), sm.Encrypto( con_str.DBName)});
//�������ӵ�������µ�dataset��
ds.Tables.Add(dt);
//д��xml�ĵ�
ds.WriteXml(AppDomain.CurrentDomain.BaseDirectory.TrimEnd(new char[] {'\\'}) +"\\" +_FileName);
//�ͷ�datatable �� dataset
dt.Dispose();
ds.Dispose();
}
catch(Exception exp)
{
//System.Windows.Forms.MessageBox.Show(exp.Message);
throw exp;
}
}
示例5: GetAxDataCreateSchema
/// <summary>
/// Creates the XML schema
/// </summary>
/// <param name="className">Class name</param>
/// <param name="methodName">Method name</param>
/// <param name="paramList">Parameters list</param>
/// <returns></returns>
public Byte[] GetAxDataCreateSchema(string className, string methodName, params object[] paramList)
{
XmlDocument xmlDoc = new XmlDocument();
try
{
this.AxLoginAs();
AxaptaObject axObj = _Axapta.CreateAxaptaObject(className);
string ret = (string)this.CallAxMethod(className, methodName, paramList);
//convert string into XML document
xmlDoc.LoadXml(ret);
//create XML data reader to populate dataset
XmlNodeReader xmlReader = new XmlNodeReader(xmlDoc.DocumentElement);
System.Data.DataSet ds = new System.Data.DataSet();
//load dataset with XML data (load schema)
ds.ReadXml(xmlReader, System.Data.XmlReadMode.InferSchema);
//GZIP compress dataset with schema. Return byte array
MemoryStream ms = new MemoryStream();
System.IO.Compression.GZipStream zip = new System.IO.Compression.GZipStream(ms, System.IO.Compression.CompressionMode.Compress);
ds.WriteXml(zip, System.Data.XmlWriteMode.WriteSchema);
zip.Close();
ms.Close();
axObj.Dispose();
return ms.GetBuffer();
}
catch (Microsoft.Dynamics.AxaptaException ex)
{
this.WriteErrorToEventLog(ex);
SoapException se = new SoapException(ex.Message, SoapException.ServerFaultCode, ex.InnerException);
throw se;
}
catch (Exception ex)
{
this.WriteErrorToEventLog(ex);
SoapException se = new SoapException(ex.Message, SoapException.ClientFaultCode, ex.InnerException);
throw se;
}
finally
{
this.AxLogoff();
}
}