PDA

View Full Version : How to gnerate JSON data from MSSQL Server for ExtJS grid?



dgulf
31 Jan 2012, 8:04 PM
Hi All,

I am trying to display data from my MSSQL Server table into ExtJS grid. I am trying to write a webmethod in C# to connect to the database,execute the query and get the table data as JSON format to display it in the ExtJS grid.
I am just starting using C# and not experienced on it. I will be quite glad if anybody can share an example of a C# for gnerating JSON data from MSSQL Server.

Thanks a lot

Asim

** I posted this thread in another forum for quicker response

dedoz
31 Jan 2012, 8:47 PM
maybe u should ask this in a C# forum :d "how to : how to implement a web service that respond in json"

tvanzoelen
1 Feb 2012, 12:22 AM
You can do it yourself with a StringBuilder and write the string to the client with the Response object. But there seems to be new things for serializing JSON in the dotNet library.

http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx

and look always here for json stuff http://www.json.org/