本文介绍了输入字符串格式不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 您好, 我在插入字符串变量时遇到问题: Dim strSQL As String =" INSERT INTO tblContactForm1(txtName,txtCompany, txtPhone,txtEmail,txtComment,chkGrower,chkProduceDealer, txtOtherCustType,chkStandardBags,chkCustomBags,txtOtherBags)" + _ " VALUES(''" + txtName.Text +"'',''" + txtCompany.Text +"'',''" + txtPhone.Text +"'',''" + txtEmail.Text +"'',''" + txtComment.Text +"'',''" + chkGrower.Checked +"'',''" + chkProduceDealer.Checked + _ "'',''" + txtOtherCustType.Text +"'',''" + chkStandardBags.Checked +"'',''" + chkCustomBags.Checked +"'',''" + txtOtherBags.Text +"'');" 我在Visual Web Developer Webform中运行此过程。我有点想b / b 认为这个问题可能是第二行结束时的连续字符(+ _):如果该行没有拆分那么它会读, chkProduceDealer.Checked +"'',''" + txtOtherCustType.Text 所以我在现有的concatination旁边添加了下划线而不是 新的符号对,+ _。我尝试在其他地方打破线路,但是 没有用。 感谢您的帮助。 上帝保佑, Mark A. Sam 解决方案 Hello,I am having a problem with imputting into a string variable:Dim strSQL As String = "INSERT INTO tblContactForm1 (txtName, txtCompany,txtPhone, txtEmail, txtComment, chkGrower, chkProduceDealer,txtOtherCustType, chkStandardBags, chkCustomBags,txtOtherBags) " + _"VALUES (''" + txtName.Text + "'',''" + txtCompany.Text + "'',''" + txtPhone.Text+ "'',''" + txtEmail.Text + "'',''" + txtComment.Text + "'',''" +chkGrower.Checked + "'',''" + chkProduceDealer.Checked + _"'',''" + txtOtherCustType.Text + "'',''" + chkStandardBags.Checked + "'',''" +chkCustomBags.Checked + "'',''" + txtOtherBags.Text + "'');"I am running this procedure in a Visual Web Developer Webform. I am kind ofthinking the problem may be the contiuation characters (+ _) on the end ofthe second line: If the line wasn''t split there it would read,chkProduceDealer.Checked + "'',''" + txtOtherCustType.TextSo I added the underscore next to an existing concatination rather than anew pair of symbols, + _. I tried breaking the line somewhere else, butthat didn''t work.Thanks for any help.God Bless,Mark A. Sam 解决方案 这篇关于输入字符串格式不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 13:34