[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
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.
Re: How to split the Lengthy Insert Command Line Text Line ?
Thanks Eri...I get clear.