TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sandy Bhardwaj
1.1k
338
2.5k
How can i store Object Json in Array Json with Array name ?
Sep 15 2017 8:17 AM
//This is my code and i want to pass api with array name please give me the answer
protected void Page_Load(object sender, EventArgs e)
{
IsTrue = 0;
if (string.IsNullOrEmpty(Request.QueryString["Username"]) == false && string.IsNullOrEmpty(Request.QueryString["Password"]) == false)
{
IsTrue = 1;
}
if (IsTrue > 0)
{
DataTable dt = new DataTable();
UserName = Request.QueryString["UserName"];
Password = Request.QueryString["Password"];
con.Open();
dt.Load(new SqlCommand("select Top 10 Memberid,MemberName from PartyMaster Order by msrno", con).ExecuteReader());
con.Close();
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>();
Dictionary<string, object> row = default(Dictionary<string, object>);
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string, object>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col]);
}
rows.Add(row);
}
//string Mystr = serializer.Serialize(rows);
string Mystr = serializer.Serialize(rows);
Response.ContentType = "application/json"; //JSON Text output
Response.Write(Mystr);
}
Reply
Answers (
0
)
How to kill a user's session
How to get all Session by SessionID