简体   繁体   中英

How to query Sql Server data from JavaScript

For the following scenario:

A JavaScript client application sends a JSON query to a webservice. Simplified query example:

{
    table: "orders",
    filter: {
        date: "2011-01-25"
    }
}

The webservice compiles the request into a SQL query and executes it on SQL Server. The webservice returns the result of the query in JSON format.

I need the simplest way (technology stack) to implement the webservice. It should run under Windows Server and IIS 6 and work with SQL Server 2005. I prefer a dynamic language so that the changes in the data definition should not be kept in sync manually.

Check out these two:

It will be easier for you to use jQuery on the client side, because it's able to parse JSON for you. And if you do a search on Google aboout either of them you will find enough resources to get you started.

You will have some more configuration to do on your outdated IIS6 machine, but I suppose it should work just as well. I can't guarantee but check the web. And if at all possible upgrade to IIS7. It's about time you do...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM