By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,909 Members | 2,008 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,909 IT Pros & Developers. It's quick & easy.

Parse SQL query in C#

P: n/a
Hey all,

I am writing a query builder in C# 2005 and I want to parse the query
before I send it to the database. I remember being able to call a
Parse or TryParse method on a DMO object or something similar. It has
been a while since I have had to do this and forgot what object to
use. Anyone have any suggestions?

Thanks!

Nov 9 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Jimmy,

You are targeting SQL Server, right? You can always SET NOEXEC ON on
the connection, pass the command (which will only be compiled, not executed)
and then see what comes back. If you don't get any errors, it is valid,
otherwise, it is invalid, and you can execute your query (just don't forget
to SET NOEXEC OFF before you try and execute the query).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Jimmy V" <go*****@gmail.comwrote in message
news:11**********************@o38g2000hse.googlegr oups.com...
Hey all,

I am writing a query builder in C# 2005 and I want to parse the query
before I send it to the database. I remember being able to call a
Parse or TryParse method on a DMO object or something similar. It has
been a while since I have had to do this and forgot what object to
use. Anyone have any suggestions?

Thanks!
Nov 9 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.