using jquery to write sql queries?
how to use jquery to write sql queries. consider a webservice call using jquery to asp.net webservice, sending an sql query and getting back the results in json format. but there's a problem with the connection string because it must not be available if a us开发者_JS百科er views the source of the page.
This is a very, very, very bad idea unless you took a great deal of precaution in filtering what queries were allowed, SQL injection would be wide open to a user.
For example:
DROP Table XXXX;
Aside from that main reason...jQuery won't do anything to help with this, it can assist in whatever UI you're building, but there's nothing inherently present in jQuery to help with what you're after at all.
For the connection string bit: jQuery can't execute SQL queries...your web service would have to execute whatever anyway, so there's no connection string to be seen anyway, it's server-side.
If you're just after examples of how to do this - executing generic SQL - take a look at some project out there. For example the Stack Exchange Data Explorer where you can query StackOverflow data. It's open source, you can view it all right here.
精彩评论