I have an extremely long and complex select statement as
shown below and I need to split it onto two lines but not
quite sure how to do it because I've never needed to
before. I need to split it onto two lines because I keep
getting this error :
Compiler limit exceeded: Line cannot exceed 2046 characters
Could someone please show me how this can be done.
("Select IPC.URN, SuspectName.Surname,
SuspectName.Forenames, SuspectName.DateOfBirthS75,
Suspect.Occupation, Ref_Gender.Description,
SuspectAddress.Name, SuspectAddress.Townland,
SuspectAddress.Town, SuspectAddress.County,
SuspectAddress.Postcode, SuspectAddress.DCU,
Suspect.InCareFlag, Suspect.SolicitorFirmURN,
Suspect.PartyURN, MilitaryPersonnel.ServiceUnit,
MilitaryPersonnel.MilitaryRank,
MilitaryPersonnel.ServiceNumber,
MilitaryPersonnel.UnitAddress, Suspect.ChargeDate,
Suspect.InterimForm1Flag,
Suspect.InterimChargedSummonsedDate,
Suspect.InterimDateOfFirstCourt, Suspect.InterimStatus,
Ref_InterimStatus.Description,
SuspectPrincipalEvidence.Type,
SuspectPrincipalEvidence.OtherDescription,
Ref_PrincipalEvidenceType.Description,
SuspectMotivation.Type, Ref_MotivationType.Description,
Suspect.EvidenceAssessment,Ref_SuspectAssessmentOf Evidence.
Description,
Suspect.OutstandingEvidenceOnSubmissionToProsecuti onFlag,
Suspect.OtherDescription, Suspect.DrivingNumberOfYears
FROM ((((Suspect left outer JOIN MilitaryPersonnel ON
Suspect.URN = MilitaryPersonnel.SuspectURN) left outer
JOIN SuspectAddress ON Suspect.URN =
SuspectAddress.SuspectURN) left outer JOIN
SuspectMotivation ON Suspect.URN =
SuspectMotivation.SuspectURN) left outer JOIN
SuspectPrincipalEvidence ON Suspect.URN =
SuspectPrincipalEvidence.SuspectURN)left outer JOIN
SuspectName ON Suspect.URN = SuspectName.SuspectURN left
outer JOIN Party on Suspect.PartyURN = Party.URN left
outer JOIN Individual on Party.URN = Individual.PartyURN
left outer JOIN IPC on Suspect.IPCURN = IPC.URN left outer
JOIN Ref_Gender on Individual.Gender = Ref_Gender.code
left outer JOIN Ref_InterimStatus on Suspect.InterimStatus
= Ref_InterimStatus.Description left outer JOIN
Ref_PrincipalEvidenceType on SuspectPrincipalEvidence.Type
= Ref_PrincipalEvidenceType.Code left outer JOIN
Ref_MotivationType on SuspectMotivation.Type =
Ref_MotivationType.Code left outer JOIN
Ref_SuspectAssessmentOfEvidence on
Suspect.EvidenceAssessment =
Ref_SuspectAssessmentOfEvidence.Code where IPC.URN = 101
and Suspect.URN = 40", conSQL); 4 11244
Just break your string into multiple strings and concatenate, e.g.
string sqlQuery = "Select IPC.URN, SuspectName.Surname, " +
"SuspectName.Forenames, SuspectName.DateOfBirthS75, " +
...
"and Suspect.URN = 40";
Ken
"Anna Smith" <an*******@discussions.microsoft.com> wrote in message
news:0a****************************@phx.gbl... I have an extremely long and complex select statement as shown below and I need to split it onto two lines but not quite sure how to do it because I've never needed to before. I need to split it onto two lines because I keep getting this error : Compiler limit exceeded: Line cannot exceed 2046 characters
Could someone please show me how this can be done.
("Select IPC.URN, SuspectName.Surname, SuspectName.Forenames, SuspectName.DateOfBirthS75, Suspect.Occupation, Ref_Gender.Description, SuspectAddress.Name, SuspectAddress.Townland, SuspectAddress.Town, SuspectAddress.County, SuspectAddress.Postcode, SuspectAddress.DCU, Suspect.InCareFlag, Suspect.SolicitorFirmURN, Suspect.PartyURN, MilitaryPersonnel.ServiceUnit, MilitaryPersonnel.MilitaryRank, MilitaryPersonnel.ServiceNumber, MilitaryPersonnel.UnitAddress, Suspect.ChargeDate, Suspect.InterimForm1Flag, Suspect.InterimChargedSummonsedDate, Suspect.InterimDateOfFirstCourt, Suspect.InterimStatus, Ref_InterimStatus.Description, SuspectPrincipalEvidence.Type, SuspectPrincipalEvidence.OtherDescription, Ref_PrincipalEvidenceType.Description, SuspectMotivation.Type, Ref_MotivationType.Description, Suspect.EvidenceAssessment,Ref_SuspectAssessmentOf Evidence. Description, Suspect.OutstandingEvidenceOnSubmissionToProsecuti onFlag, Suspect.OtherDescription, Suspect.DrivingNumberOfYears FROM ((((Suspect left outer JOIN MilitaryPersonnel ON Suspect.URN = MilitaryPersonnel.SuspectURN) left outer JOIN SuspectAddress ON Suspect.URN = SuspectAddress.SuspectURN) left outer JOIN SuspectMotivation ON Suspect.URN = SuspectMotivation.SuspectURN) left outer JOIN SuspectPrincipalEvidence ON Suspect.URN = SuspectPrincipalEvidence.SuspectURN)left outer JOIN SuspectName ON Suspect.URN = SuspectName.SuspectURN left outer JOIN Party on Suspect.PartyURN = Party.URN left outer JOIN Individual on Party.URN = Individual.PartyURN left outer JOIN IPC on Suspect.IPCURN = IPC.URN left outer JOIN Ref_Gender on Individual.Gender = Ref_Gender.code left outer JOIN Ref_InterimStatus on Suspect.InterimStatus = Ref_InterimStatus.Description left outer JOIN Ref_PrincipalEvidenceType on SuspectPrincipalEvidence.Type = Ref_PrincipalEvidenceType.Code left outer JOIN Ref_MotivationType on SuspectMotivation.Type = Ref_MotivationType.Code left outer JOIN Ref_SuspectAssessmentOfEvidence on Suspect.EvidenceAssessment = Ref_SuspectAssessmentOfEvidence.Code where IPC.URN = 101 and Suspect.URN = 40", conSQL);
Hi Anna,
string selectstring = "Select IPC.URN, SuspectName.Surname, "
+ "SuspectName.Forenames, SuspectName.DateOfBirthS75, "
+ " ... "
+ "and Suspect.URN = 40";
Just add + between each string and it will be added together as a single string.
You can also use StringBuilder which is much preferred if you concatenate lots of strings.
--
Happy coding!
Morten Wennevik [C# MVP]
It should be pointed out that you should use string builder if you need
to create long strings that are dynamic in nature. If your strings are
constant, then using StringBuilder would actually work against you.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:opsdchyhqrklbvpo@stone... Hi Anna,
string selectstring = "Select IPC.URN, SuspectName.Surname, " + "SuspectName.Forenames, SuspectName.DateOfBirthS75, " + " ... " + "and Suspect.URN = 40";
Just add + between each string and it will be added together as a single string. You can also use StringBuilder which is much preferred if you concatenate lots of strings.
-- Happy coding! Morten Wennevik [C# MVP]
Just split the string somewhere and concat it with a "+";
your string: string test = "verylongverylong";
to: string test = "verylong"+
"verylong";
Thats it...
What for an application is this? The select statement looks kind of interesting :D This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Marian Heddesheimer |
last post by:
Hi,
does anybody know a good pattern for PHP regular expression (like
preg_match) to split an existing SQL statement into their parts?
For example, if I have this:
$sql = "select field1,...
|
by: Luka Milkovic |
last post by:
Hello,
I have a little problem and although it's little it's extremely difficult
for me to describe it, but I'll try.
I have written a program which extracts certain portions of my received...
|
by: rxl124 |
last post by:
Hi, room
Beginner of learning perl here!!
I have question to all,
I have below file name datebook.master which contains only 2 lines
Mike wolf:12/3/44:144 park ave, paramus: 44000
Sarah kim:...
|
by: Jan |
last post by:
I store sql-commands in a database table. In the first step I get the
sql command out of the database table with embedded sql. In the second
step I try to execute the command, which i got from the...
|
by: Tcs |
last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't
loaded it yet. I'm still using MS Access. And no, I don't believe this is an
Access question. (But who knows? I...
|
by: Lauren Quantrell |
last post by:
Is there any speed/resource advantage/disadvantage in using
Select Case x
Case 1
Case 2
etc. many more cases...
End Select
VS.
|
by: Ben |
last post by:
Hi
I am creating a dynamic function to return a two dimensional array from a
delimeted string.
The delimited string is like:
field1...field2...field3...
field1...field2...field3......
|
by: ImOk |
last post by:
I have this PHP statement which works fine and breaks down a string of
lines delimited with a \r into an array.
$arrList=split("\r", $strList);
But what I really want is to be able to tell it...
|
by: MrHelpMe |
last post by:
Hello again experts,
I have successfully pulled data from an LDAP server and now what I want
to do is drop the data into a database table. The following is my code
that will insert the data but...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |