public static string GetRow(string RowId) { if (HttpContext.Current.Session["UserName"] == null) { return("Error: You are not logged-in."); } DBClass db = new DBClass("SCM"); db.Con.Open(); db.Com.CommandText = "SELECT [id] ,[description] FROM [costsetupItemMainhead] WHERE [id] = '" + RowId + "'"; SqlDataReader dr = db.Com.ExecuteReader(); JavaScriptSerializer serailizer = new JavaScriptSerializer(); SetupLocationEntry SetupLocation = new SetupLocationEntry(); if (dr.HasRows) { while (dr.Read()) { SetupLocation.BankCode = dr[0].ToString(); SetupLocation.BankDescription = dr[1].ToString(); } } if (dr.IsClosed == false) { dr.Close(); } db.Con.Close(); db = null; return(serailizer.Serialize(SetupLocation)); }
public static string GetRow(string RowId) { if (HttpContext.Current.Session["UserName"] == null) { return "Error: You are not logged-in."; } DBClass db = new DBClass("SCM"); db.Con.Open(); db.Com.CommandText = "SELECT [id] ,[description] FROM [costsetupItemMainhead] WHERE [id] = '" + RowId + "'"; SqlDataReader dr = db.Com.ExecuteReader(); JavaScriptSerializer serailizer = new JavaScriptSerializer(); SetupLocationEntry SetupLocation = new SetupLocationEntry(); if (dr.HasRows) { while (dr.Read()) { SetupLocation.BankCode = dr[0].ToString(); SetupLocation.BankDescription = dr[1].ToString(); } } if (dr.IsClosed == false) dr.Close(); db.Con.Close(); db = null; return serailizer.Serialize(SetupLocation); }