-
November 21st, 2013, 06:09 AM
#1
[RESOLVED] How to split the Lengthy Insert Command Line Text Line ?
Hi, I have table around 90 Columns. Now my problem is when I wish to use the Insert Command
it's not executing... The reason is that the command is very lengthy... So how to split the line ?
My Command
SqlCommand^ DetailedInsert = gcnew SqlCommand("Insert into Table1 (col1,col2,col3,...col90) values (val1,val2,val3,...val90)", SqlCon);
DetailedInsert->ExecuteNonQuery();
So that DetailedInsert Command Text is very lengthy, How to split that line as like c#?
Thanks
-
November 21st, 2013, 12:08 PM
#2
Re: How to split the Lengthy Insert Command Line Text Line ?
I don't know how that's done in C#, but C++ (/CLI as well as native) interprets adjacent string literals separated by nothing but whitespace as a single string literal. That is, "x" "y" is equivalent to "xy". And as line breaks count as whitespace, this can be used to split long string literals across multiple source code lines, like this:
Code:
SqlCommand^ DetailedInsert = gcnew SqlCommand("Insert into Table1 (col1,col2,col3,...col90) "
"values (val1,val2,val3,...val90)", SqlCon);
However, C++ doesn't impose any limitation on the length of source code lines; they're just pretty annoying when editing the code. So if anything actually prevents your SQL command from executing properly, I suspect there's yet another problem.
Last edited by Eri523; November 21st, 2013 at 12:10 PM.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
November 23rd, 2013, 04:35 AM
#3
Re: How to split the Lengthy Insert Command Line Text Line ?
Thanks Eri...I get clear.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|