使用jquery / json从数据库检索数据时出错 [英] getting error in retrieving data from database using jquery/json

查看:139
本文介绍了使用jquery / json从数据库检索数据时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 [WebMethod] 
public static maj_hd [ ] bind_repter( String maj_hd)
{
List< maj_hd> list = new List< maj_hd>();
DataTable dt = new DataTable();
使用(SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings [ constringBA]。ConnectionString))
{
SqlCommand cmd = new SqlCommand( sql query,con);
使用(cmd)
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
}
}
return list.ToArray();
}

解决方案





请检查你的代码。

你没有将数据源(DataTable)分配给你的List而不绑定它。

可能是你在检索数据时遇到错误。



标记如果这是你回答。



谢谢,

kk

[WebMethod]
public static maj_hd[] bind_repter(String maj_hd)
{
     List<maj_hd> list = new List<maj_hd>();
     DataTable dt = new DataTable(); 
     using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constringBA"].ConnectionString))
     {
          SqlCommand cmd = new SqlCommand("sql query", con);
          using (cmd) 
          {
              con.Open();
              SqlDataAdapter da = new SqlDataAdapter(cmd);
              da.Fill(dt);
          }
     }
     return list.ToArray();
}

解决方案

Hi,

Please check your code.
you have not assigned your datasource (DataTable) to your List and not bind it.
may be that''s you are getting error in retrieving of data.

mark if this is you answer.

thanks,
kk


这篇关于使用jquery / json从数据库检索数据时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆