473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

String Declaration

I have an SQL statement which is quite long. I want to declare a string
variable with this SQL statement and I want to have span multiple lines. I
could scrunch it all up and place it on a single line, but then the SQL
statement would be unreadable. There was a way to do this in VB, but how do
you do this is C#?

I want it to look something like this in the code.

string mySQL = "select 'Anchor' as Anchor_NonAnchor, combo.PROCESS_GROUP,
combo.COMBINATION, cf.CHARTFIELD,
grp.COMBO_DEFN_NAME, ' ' as Tree_Name, ' ' as
Node_Name,
cf.SEQUENCE_NBR_6, cval.SELECT_VALUE as Range_From,
' ' as
Range_To
from gapsc.ps_combo_grrul_tbl combo,
gapsc.ps_combo_rule_tbl Rul,
gapsc.ps_combo_group_tbl grp,
gapsc.ps_combo_cf_tbl cf,
gapsc.ps_combo_val_tbl cval
where Rul.EFFDT_TO = '2099-01-01'
and rul.combination = combo.combination
and grp.setid = rul.setid
and combo.setid = cf.setid
and rul.combination = cf.combination
and rul.combination = cval.combination
and grp.Process_Group = combo.Process_Group
and grp.combo_defn_name = rul.combo_Defn_Name
and cf.SETID = cval.SETID
and cf.COMBINATION = cval.COMBINATION
and cf.SEQUENCE_NBR_6 = cval.SEQUENCE_NBR_6
and cf.TREE_NAME = ' ' ";

Thanks in advance!!
Oct 27 '06 #1
2 2024
string mySQL = @"Some long
text with "" double quote escapting of single quotes
that goes on and on and on";

Or use an sp (or the equivalent name for your database) ;-p

(oh don't look at me like that... someone was bound to say it!)

Marc
Oct 27 '06 #2
Marc Gravell wrote:
string mySQL = @"Some long
text with "" double quote escapting of single quotes
that goes on and on and on";

Or use an sp (or the equivalent name for your database) ;-p

(oh don't look at me like that... someone was bound to say it!)

Marc
Just for completeness, you can also continue your string onto the next
line:

string mySQL = "SELECT field1, field2 " +
" FROM table " +
"WHERE Id = @Id";

Oct 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jeff Williams | last post by:
This doesn't compile: const char** ids = { "aaa", "bbb", "ccc" }; I hope the above illustrates what I am trying to do, if it is possible, what
12
by: Riley DeWiley | last post by:
I am looking for a graceful way to declare a string const that is to be visible across many files. If I do this: //----hdr.h const char * sFoo = "foo"; //file.cpp
5
by: MLH | last post by:
I'm working with lots of long strings now, it seems. I have to import them & parse them constantly. The A97 memo field type supports only 32768 chars. What happens when this is processed... Dim...
7
by: al | last post by:
char s = "This string literal"; or char *s= "This string literal"; Both define a string literal. Both suppose to be read-only and not to be modified according to Standard. And both have...
4
by: songkv | last post by:
Hi, I am trying to reassign an array of char to a string literal by calling a function. In the function I use pointer-to-pointer since I want to reassign the "string array pointer" to the string...
12
by: Terry | last post by:
If the string object contain like below: string Mystring = " "; What function should be used for checking the "Mystring" is no char inside? Thanks Terry
24
by: v4vijayakumar | last post by:
why the following string, 'str' is read-only? char *str = "test string"; anyhow 'str' needs to be in memory. do you think, making 'str' red-only would gain performance? or, it is right?
31
by: Peter Michaux | last post by:
Hi, I want to know the name of an object's constructor function as a string. Something like this <script type="text/javascript"> function Foo(){}; var a = new Foo(); alert('"' +...
5
by: polas | last post by:
Good morning, I have a quick question to clear up some confusion in my mind. I understand that using a string literal in a declaration such as char *p = "string literal" declares a pointer to...
4
by: Chris Forone | last post by:
hello group, why have i to bracket the second ctor param in the following example? thx & hand, chris #include <fstream> #include <iterator> int main()
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.