SQL query builder

Nvbn

New member
Joined
Oct 2, 2008
Messages
3
Programming Experience
Beginner
Hi there, I need to create a utility for our app that allows users to enter SQL, in a text box, ideally parse it, reporting back any errors, then affect a selectable database update. Is there an MS component that allows the type of table view query builder? Does anyone know of a good on-line resource/example of a simple query builder, VB.net or C# ? Thank-you in advance

Or just a way to parse a SQL string entered via textbox prior to execution in order to resolve errors
 
Last edited:

Sergey Smagin

New member
Joined
Feb 8, 2007
Messages
3
Programming Experience
5-10
Hi,

Your requirements are perfectly suit to the Active Query Builder component: it has MS-style visual interface, it can parse SQL queries of any complexity and report about parsing errors (of course). Also it can be used as a parser (without GUI). The only shortcoming is that this component reports about one error only, so the user will have to correct the query many times until all errors will be fixed. The developers promise to resolve this issue in the next major version. ;)
 

Nvbn

New member
Joined
Oct 2, 2008
Messages
3
Programming Experience
Beginner
:) Thanks I shall take a look

For a more basic bit of code though, does anyone have link to an example maybe
 

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,056
Programming Experience
10+
I cant beleive youre letting your users write their own update statements.. you might as well just save yourself the time and effort and buy them a query tool like Toad for oracle (if you have oracle) or other freeform thing that will let them run rampage with.

What I have to ask is; why bother writing a parser or looking for one. The database already has one built in..

One of my apps sort of has this functionality in that it allows a user to enter a freeform query (the user is supposed to be a developer) that will run on a schedule. I test that the query works by asking Oracle to EXPLAIN PLAN FOR (query). Oracle balks if the query has a synta error, and I can relay that message back to the user. If youre using some low end db like access.. well i dont know how to get access to parse the statement without running it, but someone else might

Really though... rethink giving users riot rights very carefully
 

Nvbn

New member
Joined
Oct 2, 2008
Messages
3
Programming Experience
Beginner
Yep this is user via agreement/check or on-site consultant - password protected utility with some log facility so not a free-run to attack the data - is really in case there is not access to management studio - thanks for all advice :)
 

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,056
Programming Experience
10+
well, as noted before.. if youre letting responsible users write queries, then just let them write the query, submit it to the db and return any errors or successes that may happen. No need to parse the query yourself, just use DB securty to define accessible portions
 

Latest posts

Top Bottom