常量中有换行符

panpanyou 2010-10-12 02:04:04
我才开始学习C#,,在自己做一个QQ登录,需要连接到数据库ACCESS,,,登录的我已经做好了,可是这个注册新用户,也就是插入数据到原表中,就会提示下面的错误。。。。。这是怎么回事啊??
怎么改呢???

string insert = "insert into 登录(账号,密码)values(";
insert += "'" + this.textBox1.Text + "',";
insert += "'" + this.textBox3.Text + "'," )";

G:\c#\QQ登录系统\ff\Form3.cs(34,56): 错误 CS1010: 常量中有换行符
...全文
100 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2010-10-12
  • 打赏
  • 举报
回复
string insert = "insert into 登录(账号,密码)values(";
insert += "'" + this.textBox1.Text.Replace("\r\n","") + "',";
insert += "'" + this.textBox3.Text + "')";
oledbparameter操作
兔子-顾问 2010-10-12
  • 打赏
  • 举报
回复
string insert = "insert into 登录(账号,密码)values(";
insert += "'" + Regex.Replace(this.textBox1.Text,@"[\r\n]","") + "',";
insert += "'" + Regex.Replace(this.textBox3.Text,@"[\r\n]","") + "'," )";
q107770540 2010-10-12
  • 打赏
  • 举报
回复

string insert = "insert into 登录(账号,密码)values('"+ this.textBox1.Text + "','"+ this.textBox3.Text + "')";
q107770540 2010-10-12
  • 打赏
  • 举报
回复
string insert = "insert into 登录(账号,密码)values(‘";
insert += this.textBox1.Text + "','";
insert += this.textBox3.Text + "')";

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧