日期:2014-05-17 浏览次数:20860 次
//按id不同形成不同的文件,文件内容是XML
public void writexml(string id,string xml)
{
StreamWriter sw =new StreamWriter(Application.StartupPath + @"\" + id + ".xml");
try
{
sw.WriteLine(xml);
sw.Close();
}
catch (Exception ex )
{
MessageBox.Show(ex.Message);
}
}
private void button18_Click(object sender, EventArgs e)
{
SqlConnection cnn=new SqlConnection();
cnn.ConnectionString = @"server=192.168.1.2;database=data;user id=sa;password=sa";
cnn.Open();
DataSet ds =new DataSet();
SqlDataAdapter da=new SqlDataAdapter("select * from table", cnn);
cnn.Close();
da.Fill(ds, "table");
if(ds.Tables[0].Rows.Count==0)
{
for(int i=0;i<ds.Tables[0].Rows.Count - 1;i++)
&n