如何将长字符串分割成多行 [英] How to break long string to multiple lines

查看:168
本文介绍了如何将长字符串分割成多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vba excel中的代码中使用了这个insert语句,但是我无法将其分解成多行。

  SqlQueryString =Insert into Employee values(& txtEmployeeNo.Value&_ 
,'& txtContractStartDate.Value&'_
,'& txtSeatNo。 Value&'_
,'& txtFloor.Value&','& txtLeaves.Value&')

它给出错误预期结束语句。 Plz帮助。

解决方案

您不能在字符串内使用VB行连续字符。

  SqlQueryString =插入员工值(& txtEmployeeNo.Value& _ 
','& txtContractStartDate.Value& _
','& txtSeatNo.Value& _
','& txtFloor.Value&','& txtLeaves.Value&' b $ b


I'm using this insert statement in my code in vba excel but i'm not able to break it into more than one line

SqlQueryString = "Insert into Employee values(" & txtEmployeeNo.Value & " _
,'" & txtContractStartDate.Value & "' _
,'" & txtSeatNo.Value & "' _
,'" & txtFloor.Value & "','" & txtLeaves.Value & "')"

It is giving error "Expected end of statement". Plz help.

解决方案

You cannot use the VB line-continuation character inside of a string.

SqlQueryString = "Insert into Employee values(" & txtEmployeeNo.Value & _
"','" & txtContractStartDate.Value &  _
"','" & txtSeatNo.Value & _
"','" & txtFloor.Value & "','" & txtLeaves.Value & "')"

这篇关于如何将长字符串分割成多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆