SqlConnection conn = new SqlConnection();
            conn.ConnectionString = "data source=.;initial catalog=demo;user id=sa;password=sa";
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "select * from wz_ksdm";
            cmd.Connection = conn;
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            DataSet ds = new DataSet();
            da.Fill(ds, "wz_ksdm");
            DataSet ds1 = new DataSet();
            ds1.ReadXml(Application.StartupPath.ToString() + "http://www.cnblogs.com/../" + "WZKSDM.XML");
            ////ds.Tables["wz_da"].ReadXml();
            SqlCommand insertcmd = new SqlCommand();
            //insertcmd.CommandText = "insert into wz_bz(id,cyyfl,cyy) values(@id,@cyyfl,@cyy)";
            insertcmd.CommandText = "insert into wz_ksdm(ksdm,ksmc,srm1,srm2,srm3) values(@ksdm,@ksmc,@srm1,@srm2,@srm3)";

            insertcmd.Parameters.Add("@ksdm", SqlDbType.VarChar,10,"ksdm");
            insertcmd.Parameters.Add("@ksmc", SqlDbType.VarChar,30, "ksmc");
            insertcmd.Parameters.Add("@srm1", SqlDbType.VarChar,6, "srm1");
            insertcmd.Parameters.Add("@srm2", SqlDbType.VarChar,6, "srm2");
            insertcmd.Parameters.Add("@srm3", SqlDbType.VarChar,6,"srm3");
            da.InsertCommand = insertcmd;
            insertcmd.Connection = conn;
           MessageBox.Show(da.Update(ds1.Tables[0]).ToString()); 


文章来源:http://www.cnblogs.com/wangdetian168/archive/2008/06/25/1230016.html
posted on 2010-09-28 11:00 sanmao 阅读(273) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜