SqlDataReader
时间:2021-07-01 10:21:17
帮助过:30人阅读
void ProcessRequest(HttpContext context)
{
List<Goods_date> goods_date =
new List<Goods_date>
();
Mg_all<List<Goods_date>> obj =
new Mg_all<List<Goods_date>>
();
string result =
string.Empty;
context.Response.ContentType =
"text/plain";
// string conStr = ConfigurationManager.ConnectionStrings["conStr"].ConnectionString;
string ConnectionString =
"数据库";
MySqlConnection conn =
new MySqlConnection(ConnectionString);
conn.Open();
//Goods_date goods_date = new Goods_date();
string str1 =
"Select * from tickets";
MySqlCommand cmd =
new MySqlCommand(str1,conn);
MySqlDataReader dr =
cmd.ExecuteReader();
while (dr.Read())
{
goods_date.Add(new Goods_date { ID = dr.GetString(
0),player=dr.GetString(
1), officer = dr.GetString(
2), time = dr.GetString(
3), date = dr.GetString(
4), amount = dr.GetString(
5), paid = dr.GetString(
6) });
}
dr.Close();
dr.Dispose();
obj.code =
"0";
obj.msg =
"";
obj.count =
"10";
obj.data =
goods_date;
result=
new JavaScriptSerializer().Serialize(obj);
context.Response.Write(result);
}
SqlDataReader
标签:text play off response tst 创建 表示 offic man