Question : How do i use/conver the following code to Csharp.net?

I am using a dojo data grid to display a data grid and I have it working using a classic asp file to access my MS Sql database to output a simple query to JSON. However, i need this to work in csharp.net. What is the best way to do what this code does in c#? I have included all the code, but have purposely changed the connection string, for obvious reasons. Any help would be appreciated.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
<!---- #Include file="JSON_2.0.2.asp" --->
<!---- #include file="JSON_UTIL_0.1.1.asp" ----> 
<%
Dim member
Set member = jsObject()
set conn=Server.CreateObject("ADODB.Connection")
conn.ConnectionString="DSN=sql.dsn;database=db24;UID=reader;PWD=k34ghh65hnsh5463"
conn.Open
		
jmode = request.Form("jmode")
load_mode = request.QueryString("profile_id")

if jmode = "add" then

elseif jmode = "edit" then

elseif jmode = "delete" then

else
'load it
    pStr = "private, no-cache, must-revalidate" 
    Response.ExpiresAbsolute = #2000-01-01# 
    Response.AddHeader "pragma", "no-cache" 
    Response.AddHeader "cache-control", pStr 
	response.Write "{identifier: 'id', label: 'id', items: "
	QueryToJSON(conn, "select id, type_code, f_id, name, address_l1, address_l2, city, state, o_officer, phone_number, description, amount from dbo.PRIMARY_Non").flush
	response.Write "}"


end if
conn.Close
%>
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
<!---- #Include file="JSON_2.0.2.asp" --->
<!---- #include file="JSON_UTIL_0.1.1.asp" ----> 
<%
Dim member
Set member = jsObject()
set conn=Server.CreateObject("ADODB.Connection")
conn.ConnectionString="DSN=sql.dsn;database=db24;UID=reader;PWD=k34ghh65hnsh5463"
conn.Open
		
jmode = request.Form("jmode")
load_mode = request.QueryString("profile_id")

if jmode = "add" then

elseif jmode = "edit" then

elseif jmode = "delete" then

else
'load it
    pStr = "private, no-cache, must-revalidate" 
    Response.ExpiresAbsolute = #2000-01-01# 
    Response.AddHeader "pragma", "no-cache" 
    Response.AddHeader "cache-control", pStr 
	response.Write "{identifier: 'id', label: 'id', items: "
	QueryToJSON(conn, "select id, type_code, f_id, name, address_l1, address_l2, city, state, o_officer, phone_number, description, amount from dbo.PRIMARY_Non").flush
	response.Write "}"


end if
conn.Close
%>

Answer : How do i use/conver the following code to Csharp.net?

Not sure if this link is helpfull (in case of Kaseya) but here it is anyway ;)

http://discussions.apple.com/thread.jspa?threadID=1664101
Random Solutions  
 
programming4us programming4us