
要么在config中连接数据库字段中进行设置
<appSettings>
<add key="Connection" value="Server=127.0.0.1User ID=rootPassword=Database=数据库CharSet=gb2312"/>
</appSettings>
要么在程序中指定
MySQLCommand mCommand = new MySQLCommand("set names gb2312", Connection)
你的想法是对的。但写法不对。你是用ASP的么是的话请改下SQL等于:(假设你的字段都是字符类型)
sql="insert into student (xh,xm,cj) values('"&xh&"','"&xm&"','"&cj&"'))"
应该可以插入。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)