以下是引用bdx808在2009-10-15 20:23:52的发言:
还是不太懂,比如:将姓名的值写入xm、地区(select1)、地址(textbox1)的值写入dz中,上面的代码用在哪里?下面的代码怎样修改呢?
SqlConnection conn = new SqlConnection();
conn.ConnectionString ...
SqlConnection conn = new SqlConnection();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["bmxtConnectionString"].ToString();
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
=string.Format("INSERT INTO tb(xm,dz) VALUES("姓名",'{0}')",textbox1.Text);
conn.Close();
[
本帖最后由 fed24 于 2009-10-16 09:58 编辑 ]