p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Crystal Reports for VS.NET (http://p2p.wrox.com/forumdisplay.php?f=45)
-   -   Dynamically Changing SQL Commands? (http://p2p.wrox.com/showthread.php?t=13131)

avantjer May 18th, 2004 03:27 PM

Dynamically Changing SQL Commands?
 
I have developed an ASP.NET application that uses an “SQL Command” as described in the section “Working with SQL Commands" on page 181. I need to be able to change that command programmatically at runtime but I can’t find a way to do it. The change I would make would be to the WHERE clause, and the resulting table would have the same format as that specified in the report designer. Is there a way to alter the SQL Command programmatically, on the fly, at runtime?

Thank you…

Jerry

bmains May 18th, 2004 03:55 PM

Hey,

Sure you can dynamically build a command. It sounds like you're creating dynamic SQL though; so none of the SQL queries can be predefined in advanced? If not, you can use string manipulation or regular expressions to parse apart the SQL string.

strSQL = strSQL.Substring(0, strSQL.indexOf(" WHERE "))

OR

' \. means any characters, and the + means one or more
strSQL = Regex.Replace(strSQL, " WHERE \.+", "")

Something like that,

Brian

melvik May 18th, 2004 11:29 PM

u just make a string as a command & run set to a command Obj, this will be ur dynamic Command! So simple.

Always:),
Hovik Melkomian.


All times are GMT -4. The time now is 08:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.