newbie style question : SQL statements in code

mrdippy

Member
Joined
Mar 27, 2008
Messages
9
Programming Experience
5-10
Hello - newbie'ish question.
I'm writing short use utilities in VB.NET that have SQL statements embedded in the code which I assign to variables.

It hacks me off to break up a perfectly fine but long SQL statement into multiple double quoted strings and string it together with & _ just to make the code more readable, and similarly formatted as to how it was when I wrote it in the first place using query analyzer.

With VB.NET is there an artful style or operator I can put in front of the double quotes to make this cleaner? (by operator I'm thinking of how @" xxx " escapes backwacks for you in your string, is there something akin to that for letting your strings wrap multiple lines without need of & _ appending)

Thanks!
 
Hello - newbie'ish question.
I'm writing short use utilities in VB.NET that have SQL statements embedded in the code which I assign to variables.

It hacks me off to break up a perfectly fine but long SQL statement into multiple double quoted strings and string it together with & _ just to make the code more readable, and similarly formatted as to how it was when I wrote it in the first place using query analyzer.

With VB.NET is there an artful style or operator I can put in front of the double quotes to make this cleaner? (by operator I'm thinking of how @" xxx " escapes backwacks for you in your string, is there something akin to that for letting your strings wrap multiple lines without need of & _ appending)

Thanks!

Alternatively, if you're prepared to learn how to use the designer to write your SQLs then you wont ever see your SQLs in code. Your code shouldnt have SQLs in, because it violates sensible OO notions of low coupling and encapsulation..

To whit, youre engaging in a lot of hard work forming the very rod that youre beating your own back with. Write your SQLs in the DataSet designer, in a tableadapter and your irk will go away, and your code will be better written, faster, more secure and take less time to generate..

Take a read of the DW2 link in my sig. Section to start with is Creating a Simple Data App. Read on from there as curiousity grows
 
I thought I'd take a look at those data walkthroughs myself for the first time cjard and I got "Content not found". I think they may have moved the page you linked to.

EDIT: Scrub that. I think it did that because it went via a Windows Live login page. I tried again and it worked.
 

Latest posts

Back
Top