如何写插入语句 SqlCommand comm = new SqlCommand( "insert into student (studentID,Name,age)"+"values('"+TextBox1 .Text+ "''"+TextBox2 .Text +"''"+TextBox4 .Text+"')" ,connection );是不是这样,,请各位高人指点一下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用我这个string cmdText = string.Format("insert into student (studentID,Name,age) values('{0}','{1}',{2})", TextBox1.Text, TextBox2.Text,TextBox4.Text);最好还是使用parameter方式给sql语句中的参数赋值 SqlCommand comm = new SqlCommand( "insert into student (studentID,Name,age) values('"+TextBox1 .Text.replace("'","")+ "', "+TextBox2 .Text.replace("'","")+"','"+TextBox4 .Text.replace("'","")+"')" ,connection ); 二楼的用的是占位符,也不是太好,最好用Parameter不然在这些TEXTBOX的TEXT内容里如果有特殊字符的话也会有问题的比如英文字符的逗号 求助webBrowser控件获取标签的问题。 简单javascript 求助 请问如何存储图片再exe里面并用picturebox显示 C#选项卡 问题请教 一个变量dispose()之后,再=null有用吗? winform中的focus()和tabIndex的问题!! fax faxstatus不明白为什么取到永远只有一种状态 关于模拟QQ客户度操作的一些经验 软件工程硕士和系分,哪个市场更认可呢? 请问在sql server中怎么进行字段的关联 关于ComboBox控件的问题 求印刷生产的管理软件源码,要求C#或者 DELPHI的 源码
values('{0}','{1}',{2})", TextBox1.Text, TextBox2.Text,TextBox4.Text);最好还是使用parameter方式给sql语句中的参数赋值
比如英文字符的逗号