C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着
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());
posted on 2008-06-12 00:12  王德田  阅读(218)  评论(0编辑  收藏  举报