473,508 Members | 4,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# breaking up long lines of code

123 New Member
I've searched a few websites and none of them meantion how to break up really long lines of code like a sql query.

The sql statement looks like this (I've broked it down so it can fit in the post):
String sSQL = "SELECT dbo.Issues.CreatedDate as Created, dbo.Issues.ModifiedDate as Modified, dbo.Issues.Field1 AS Repro, dbo.Issues.Field3 AS Notes dbo.Issues.Field2 as Priority, dbo.Issues.Field11 AS Build, dbo.Issues.Field12 as Description, dbo.Issues.Field25 AS VersionIn, dbo.Issues.Field26 As VersionFixed dbo.Issues.ID,dbo.Types.Name AS Type, dbo.Issues.Synopsis dbo.States.Name AS State, dbo.States.ID AS StatesID, dbo.Users.Name AS [User], dbo.Projects.Name AS Projects FROM dbo.Issues INNER JOIN dbo.Projects ON dbo.Issues.ProjectID = dbo.Projects.ID INNER JOIN dbo.States ON dbo.Issues.StateID = dbo.States.ID INNER JOIN dbo.Types ON dbo.Issues.TypeID = dbo.Types.ID INNER JOIN dbo.Users ON dbo.Issues.AssignedUserID = dbo.Users.ID WHERE ( dbo.Projects.ID = 66)";

I'm not sure if this post should be here, but I figured it is worth a shot. Thanks for any advice.
Newbie19
Jan 3 '08 #1
4 2193
weaknessforcats
9,208 Recognized Expert Moderator Expert
You shouold be able to:
Expand|Select|Wrap|Line Numbers
  1. String sSQL = "SELECT dbo.Issues.CreatedDate as Created,"
  2.                      + " dbo.Issues.ModifiedDate as Modified,"
  3.                      + " dbo.Issues.Field1 AS Repro,"
  4.                      + " dbo.Issues.Field3 AS Notes dbo.Issues.Field2 as Priority,"
  5.                      +etc....
  6.  
Jan 3 '08 #2
Newbie19
123 New Member
You shouold be able to:
Expand|Select|Wrap|Line Numbers
  1. String sSQL = "SELECT dbo.Issues.CreatedDate as Created,"
  2.                      + " dbo.Issues.ModifiedDate as Modified,"
  3.                      + " dbo.Issues.Field1 AS Repro,"
  4.                      + " dbo.Issues.Field3 AS Notes dbo.Issues.Field2 as Priority,"
  5.                      +etc....
  6.  
Thank you very much, C# is more like Java then I realized.

Thanks again,

Newbie19
Jan 3 '08 #3
Plater
7,872 Recognized Expert Expert
Thank you very much, C# is more like Java then I realized.

Thanks again,

Newbie19
You can also do:
Expand|Select|Wrap|Line Numbers
  1. String sSQL = "";
  2. sSQL += "SELECT dbo.Issues.CreatedDate as Created,";
  3. sSQL += " dbo.Issues.ModifiedDate as Modified,"
  4. sSQL += " dbo.Issues.Field1 AS Repro,"
  5. sSQL += " dbo.Issues.Field3 AS Notes dbo.Issues.Field2 as Priority,"
  6. //sSQL += etc....
  7.  
(There is a "cost" with this as it re-creates the string everytime.)
Jan 3 '08 #4
camel
55 New Member
If you are going to need a lot of concatenations best option is likely the System.Text.StringBuilder which overcomes the performance issues of +=
Jan 3 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1517
by: Michael Satterwhite | last post by:
I have a survey form that I want mailed to the client. I've built the message body as plain text and tested it by writing it to a file and examining the file. It's being built correctly. When I...
87
6332
by: Frances Del Rio | last post by:
is there a non-breaking hyphen in HTML?? for example, so a phone no. falls all on one line.. as in.. 1-800-444-5454... (and is not broken into two lines if phone no. occurs near end of a...
27
31362
by: The Bicycling Guitarist | last post by:
Hi. I found the following when trying to learn if there is such a thing as a non-breaking hyphen. Apparently Unicode has a ‑ but that is not well-supported, especially in older browsers. Somebody...
2
4091
by: vic y | last post by:
Created a SP that uses system function XP_SENDMAIL. I want to be able to send a HYPERLINK in the email. The HYPERLINK is created dynamically and generally long in length (exceeds default width of...
22
7975
by: stevenkobes | last post by:
If a word has a hyphen in it, IE will permit a line break at the hyphen, but Firefox/Mozilla won't. Apparently the Firefox behavior is standards-compliant, but it is not what I want. Is there a...
1
1730
by: BerkshireGuy | last post by:
Hello everyone, I am reading a query's SQL string and adding criteria to that and then resaving it. I know, might not be the best method, but it seems to work and there are some pros to doing...
150
6322
by: tony | last post by:
If you have any PHP scripts which will not work in the current releases due to breaks in backwards compatibility then take a look at http://www.tonymarston.net/php-mysql/bc-is-everything.html and...
49
2737
by: elmar | last post by:
Hi Clers, If I look at my ~200000 lines of C code programmed over the past 15 years, there is one annoying thing in this smart language, which somehow reduces the 'beauty' of the source code...
6
3518
by: iheartvba | last post by:
Hi I have got the following code from someone else Sub MultiColsToA() Dim rCell As Range Dim lRows As Long Dim lCols As Long Dim lCol As Long Dim ws As Worksheet ...
0
7128
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
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.