Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can we simplify this?
Message
From
10/01/2003 11:41:09
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
 
To
10/01/2003 08:36:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00740222
Message ID:
00740339
Views:
14
> MySQL = "SELECT agbrands.brandname, agclients.clientname, alltrim(Agind.prefix) As Prefix, alltrim(agind.fname) As Firstname, alltrim(agind.initial) as Initial, alltrim(agind.sname) as Surname, "
> MySql = MySql + " alltrim(agind.position) as position, agind.phone as Phone, agind.fax as Fax, agind.email as eMail, "
> MySql = MySql + " agencies.agname as Agencyname, IIF(agencies.mediaco = .T.,'M','A'), "
> MySql = MySql + " agencies.agadd1 as Address1, agencies.agadd2 as Address2, "
> MySql = MySql + " agencies.agadd3 as Address3, agencies.agadd4 as Address4, alltrim(agencies.county) As County, alltrim(postcode) as Postcode "
> MySQL = MySql + " FROM agencies "
> MySQL = MySql + " INNER JOIN agind "
> MySQL = MySql + " INNER JOIN indvcl "
> MySQL = MySql + " INNER JOIN agbrands "
> MySQL = MySql + " INNER JOIN agclients "
> MySQL = MySql + " ON Agbrands.clientid = Agclients.clientid "
> MySQL = MySql + " ON Agbrands.brandid = Indvcl.brandid "
> MySQL = MySql + " ON Agind.agindid = Indvcl.agindid "
> MySQL = MySql + " ON Agencies.agencyid = Agind.agencyid "
> MyWhere = "WHERE alltrim(Agbrands.siccode2) = (" + ctl + ") GROUP BY Agind.agindid Order By agclients.clientname, agbrands.brandname into array aTemp"
> lcCommand = MySql + MyWhere
> &lcCommand

Brendan,

Others have shown you better ways, but when you're building a long string it's easier to write it without repeating the "MySQL = MySql + " every time. Also, "[" and "]" can be used as string delimiters, making it a lot easier to work with internal single or double quotes.

MySQL = ;
"SELECT SomeStuff " + ;
"FROM Somewhere " + ;
"INTO Someplace " + ;
"and so on... "
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform