title: How to create JSONArray in c# and send that data to Android app
body: <p>In my android application,my database is over MS SQL server. And to access that database, I am creating a c# script and calling from my app same as php.My activity is a login activity where user enters his Username and Password, then on button click, that c# script is calling to check that username and password is valid or not. If valid, then will send that user's data in JSONArray format and if Invalid, then will send a <code>code=0</code> in json format. But I don't know how to send JSON data from c# to android like php. Here is my c# code below whatever I wrote. Please help me how to send JSON data from MS SQL and c# to Android.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;
  using System.Data.SqlClient;
  
  namespace LoginForm
  {
      public class LoginCheck
      {
          string strUser=Request.Querystring["strUser"];//getting username from activity
          string strPassword=Request.Querystring["strPassword"];//getting password from activity
  
          try
          {
              SqlDataReader myReader = null;
              SqlConnection conn = new SqlConnection("Data Source=***.**.**.*; Initial Catalog=GPSDB;Persist Security Info=True;User ID=##;Password=##$$#@!@!#");
                      conn.Open();
              SqlCommand check = new SqlCommand("select * from Table_User where strUser=@strUser AND strPassword=@strPassword;", conn);
              check.Parameters.AddWithValue("@strUser",strUser);
              check.Parameters.AddWithValue("@strPassword",strPassword);
              SqlDataAdapter da = new SqlDataAdapter(cmd);
              DataTable dt = new DataTable();
              da.Fill(dt);
              if(dt.Rows.Count&gt;0)
              {
                  //JSON code...
              }    
          }
      }
  }
  </code></pre>