How to break long string to multiple lines

前端 未结 4 646
清歌不尽
清歌不尽 2020-12-06 03:54

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         


        
4条回答
  •  悲&欢浪女
    2020-12-06 04:51

    you may simply create your string in multiple steps, a bit redundant but it keeps the code readable and maintain sanity while debugging or editing

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

提交回复
热议问题