public static string GetRow(string RowId) { if (HttpContext.Current.Session["UserName"] == null) { return("Error: You are not logged-in."); } DBClass db = new DBClass("Muntazm"); db.Con.Open(); db.Com.CommandText = "SELECT [CurCode],[CurDesc] FROM [Currencies] WHERE [CurCode] ='" + RowId + "'"; SqlDataReader dr = db.Com.ExecuteReader(); JavaScriptSerializer serailizer = new JavaScriptSerializer(); SurchResult SurchResult = new SurchResult(); if (dr.HasRows) { while (dr.Read()) { SurchResult.SurCode = dr[0].ToString(); SurchResult.SurDescription = dr[1].ToString(); //curriencies.DecimalDescription = dr[2].ToString(); //curriencies.Status = dr[3].ToString(); } } if (dr.IsClosed == false) { dr.Close(); } db.Con.Close(); db = null; return(serailizer.Serialize(SurchResult)); }
public static string GetRow(string RowId) { if (HttpContext.Current.Session["UserName"] == null) { return "Error: You are not logged-in."; } DBClass db = new DBClass("Muntazm"); db.Con.Open(); db.Com.CommandText = "SELECT [CurCode],[CurDesc] FROM [Currencies] WHERE [CurCode] ='"+ RowId +"'"; SqlDataReader dr = db.Com.ExecuteReader(); JavaScriptSerializer serailizer = new JavaScriptSerializer(); SurchResult SurchResult = new SurchResult(); if (dr.HasRows) { while (dr.Read()) { SurchResult.SurCode = dr[0].ToString(); SurchResult.SurDescription = dr[1].ToString(); //curriencies.DecimalDescription = dr[2].ToString(); //curriencies.Status = dr[3].ToString(); } } if (dr.IsClosed == false) dr.Close(); db.Con.Close(); db = null; return serailizer.Serialize(SurchResult); }