Hi.
Webmethod retrieves data from the database. How to return the data in the JSON format, and use them with Jquery?. Method code
public string Info(string id)
{
string image="";
string name="";
string vol="";
var cs = ConfigurationManager.ConnectionStrings["dbstr"];
var sc = new SqlConnection(cs.ConnectionString);
sc.Open();
string str = "Select * From [Products] WHERE [id]=@id";
var cmd = new SqlCommand(str, sc);
cmd.Parameters.AddWithValue("@id", id);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
image = dr["Photo"].ToString();
name = dr["Name"].ToString();
vol = dr["Volume"].ToString();
}
sc.Close();
return ? ...
Go to the complete details ...