string str = "server='(local)';database='book_manage';uid='sa';pwd='123'"; //连接数据库
SqlConnection con = new SqlConnection(str); //创建连接
con.Open(); //打开连接
string strsql =
"insert into StoreIn(bookid,bookname,editor,booknum,publishname,bookprice,pulicationdate,booktype) values ('" + bookid.Text + "' ,'" + bookname.Text + "','" + editor.Text + "','" + booknum.Text + "' ,'" + publishname.Text + "','" + bookprice.Text + "','" + pulicationdate.Text + "' ,'" + booktype.Text + "')";
SqlCommand sqlcom = new SqlCommand(strsql, con); sqlcom.ExecuteNonQuery(); con.Close();
SqlConnection con = new SqlConnection(str); //创建连接
con.Open(); //打开连接
string strsql =
"insert into StoreIn(bookid,bookname,editor,booknum,publishname,bookprice,pulicationdate,booktype) values ('" + bookid.Text + "' ,'" + bookname.Text + "','" + editor.Text + "','" + booknum.Text + "' ,'" + publishname.Text + "','" + bookprice.Text + "','" + pulicationdate.Text + "' ,'" + booktype.Text + "')";
SqlCommand sqlcom = new SqlCommand(strsql, con); sqlcom.ExecuteNonQuery(); con.Close();
解决方案 »
- 回车提交表单document.from1 is null or not an object
- .NET页面变量的问题
- ★关于Menu控件的下拉菜单怎调成透明的?????紧急啊!!!!!
- Vs.net 2005中如何连接mdf数据库
- 下面提示我表空间够,但我加大表空间,还是没有解决,帮我看看。。
- 还是很菜的问题,不过这个菜的有点难度了
- DateGrid中的ImageButton问题(请教高手)
- 如何理解解决方案?
- 求救!有没有人可以帮我解决这个问题?
- 谁有能告诉我WebService的工作原理和要注意的问题?谢谢!
- ASP.NET里面的SQL语句语法格式
- 超弱的问一句,关于visual Studio2010中创建一个网站
'(' 附近有语法错误。
string str = "server='(local)';database='book_manage';uid='sa';pwd='123'"; //连接数据库
SqlConnection con = new SqlConnection(str); //创建连接
con.Open(); //打开连接
string strsql =
"insert into StoreIn(bookid,bookname,editor,booknum,publishname,bookprice,pulicationdate,booktype) values ('" + bookid.Text + "' ,'" + bookname.Text + "','" + editor.Text + "'," + booknum.Text + " ,'" + publishname.Text + "'," + bookprice.Text + ",'" + pulicationdate.Text + "' ,'" + booktype.Text + "')";
SqlCommand sqlcom = new SqlCommand(strsql, con); sqlcom.ExecuteNonQuery(); con.Close();
string str = "server='(local)';database='book_manage';uid='sa';pwd='123'"; //连接数据库
SqlConnection con = new SqlConnection(str); //创建连接
con.Open(); //打开连接
string strsql =
"insert into StoreIn(bookid,bookname,editor,booknum,publishname,bookprice,pulicationdate,booktype) values ('" + bookid.Text + "' ,'" + bookname.Text + "','" + editor.Text + "','" + booknum.Text + "' ,'" + publishname.Text + "','" + bookprice.Text + "','" + pulicationdate.Text + "' ,'" + booktype.Text + "')";
SqlCommand sqlcom = new SqlCommand(strsql, con); sqlcom.ExecuteNonQuery(); con.Close();