在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
First of all, we have to fetch the records from the database (MS Sqlserver) into the C# DataTable, or we can add dynamic rows to our DataTable. So our code looks like as written below.
//*
)
{
;
;
;
;
;
;
;
;
;
;
;
;
}
方法一:Fetch each data (value), and append to our jsonString StringBuilder. This is how our code looks like
)
{
;
)
{
;
)
{
;
)
{
)
{
)
;
}
)
{
)
;
}
}
)
{
;
}
else
{
;
}
}
;
}
;
}
//*
方法 2: Convert DataTable to JSON using JavaScriptSerializer:)
{
;
;
;
)
{
;
)
{
;
}
;
}
;
}
方法3(推荐): Convert DataTable to JSON using Json.Net DLL (Newtonsoft):)
{
;
;
;
}
First of all, we have to fetch the records from the database (MS Sqlserver) into the C# DataTable, or we can add dynamic rows to our DataTable. So our code looks like as written below.
//*
)
{
;
;
;
;
;
;
;
;
;
;
;
;
}
方法一:Fetch each data (value), and append to our jsonString StringBuilder. This is how our code looks like
)
{
;
)
{
;
)
{
;
)
{
)
{
)
;
}
)
{
)
;
}
}
)
{
;
}
else
{
;
}
}
;
}
;
}
//*
方法 2: Convert DataTable to JSON using JavaScriptSerializer:)
{
;
;
;
)
{
;
)
{
;
}
;
}
;
}
方法3(推荐): Convert DataTable to JSON using Json.Net DLL (Newtonsoft):)
{
;
;
;
}
|
请发表评论