Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write string query on multiple lines
#1
Hey guys,

I've built a MySQL query (below) that I'm using in my application. This is a rather long query and I can't figure out how to get it to display in multiple lines using (& _).

[code2=vbnet]dbQuery = "INSERT INTO customer (accountNumber, nameLAST, nameFIRST, nameCOMPANY, addressSTREET, addressSTREET1, addressCITY, addressSTATE, addressZIPCODE, phone, fax, email) VALUES('" & TextBoxAccount.Text & "','" & TextBoxLastName.Text & "','" & TextBoxFirstName.Text & "','" & TextBoxCompanyName.Text & "','" & TextBoxAddress1.Text & "','" & TextBoxAddress2.Text & "','" & TextBoxCity.Text & "','" & ComboBoxState.SelectedItem & "','" & MaskedTextBoxZip.Text & "','" & MaskedTextBoxPhone.Text & "','" & MaskedTextBoxFax.Text & "','" & TextBoxEmail.Text & "')"[/code2]

Your help would be greatly appreciated.

Thanks.
//Kismet
#2
Try something like this!

[code2=vbnet]dbQuery = "INSERT INTO customer (accountNumber, nameLAST, nameFIRST, nameCOMPANY," & _
"addressSTREET, addressSTREET1, addressCITY, addressSTATE, addressZIPCODE, phone, fax, email)" & _
"VALUES('" & TextBoxAccount.Text & "','" & TextBoxLastName.Text & "','" & TextBoxFirstName.Text & _
"','" & TextBoxCompanyName.Text & "','" & TextBoxAddress1.Text & "','" & TextBoxAddress2.Text & "','" & _
TextBoxCity.Text & "','" & ComboBoxState.SelectedItem & "','" & MaskedTextBoxZip.Text & "','" & _
MaskedTextBoxPhone.Text & "','" & MaskedTextBoxFax.Text & "','" & TextBoxEmail.Text & "')"[/code2]

Basically, you just put a _ on the end of every line!
My Blog | My Setup | My Videos | Have a wonderful day.


Possibly Related Threads…
Thread Author Replies Views Last Post
  multiple csv files add sql server tables via VB.NET secilsengul 1 9,969 04-16-2014, 10:27 AM
Last Post: brco900033
  Problems with dividing a string brco900033 6 23,458 10-26-2013, 07:31 AM
Last Post: brco900033
  Convert 2 lines to one brco900033 2 11,906 02-23-2013, 11:04 AM
Last Post: brco900033
  [SOLVED] MySQL Update Query - What am I doing wrong? kismetgerald 11 43,296 10-18-2012, 07:16 PM
Last Post: brandonio21
  Read certain lines brco900033 3 14,625 09-26-2012, 03:56 PM
Last Post: brandonio21
  Read and delete lines brco900033 6 22,559 09-16-2012, 09:38 AM
Last Post: brandonio21
  Search ListBox + Convert ListBox.item to string brco900033 3 14,573 09-13-2012, 03:03 PM
Last Post: brandonio21
  VB.Net Query Builder Problems. Moldraxian 2 12,536 08-17-2012, 05:33 AM
Last Post: Moldraxian
  Outputting a string with quotation marks in it. openeXpressions 15 47,646 12-20-2011, 09:24 PM
Last Post: openeXpressions
  Problems with multiple textboxes and coding LearningVB2010 30 92,814 02-28-2011, 07:39 AM
Last Post: brandonio21

Forum Jump:


Users browsing this thread: 1 Guest(s)