我想了解如何传输我的存储过程(每当我在Microsoft Visual Studio Express 2012 for Windows Desktop中调试它时在控制台中打印XML文件)使用c#进入目录文件夹。下面是一个例子代码来澄清我的发言,如果有帮助就够了:如何将存储过程文件传输到XML目录
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Xml;
namespace Web_Collage_feed
{
public class CreateDirectory
{
static void Main(string[] args)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["connect"].ConnectionString);
Jack.Data.Sql work = new Jack.Data.Sql(con);
con.Open();
SqlCommand com = new SqlCommand();
com.CommandType = CommandType.StoredProcedure;
DataSet data = work.ExecuteProcedureQuery("dbo.FEED_WebCollage", com);
string productXml = data.Tables[0].Rows[0][0].ToString();
Console.WriteLine(productXml);
}
}
}
所有代码的上面让我可以在包含在它的XML内容的控制台窗口中打开productXML。我想要做的是使用c#编程技术在文件中打开该XML(将该文件存储在目录文件夹中)。
我接受各种帮助和建议(非常感谢),如果有任何问题想要问,请让我知道,我会尽快答复他们编辑我原来的问题的内容。感谢您阅读这篇文章。