注册 登录
编程论坛 ASP.NET技术论坛

存储过程返回表问题

狂砍程序 发布于 2008-05-14 20:57, 1501 次点击
方法
 public static void  woako(DataList dls)
    {
        string conn = System.Configuration.ConfigurationManager.AppSettings["wokao"];
        SqlConnection con = new SqlConnection(conn);
        SqlCommand com = new SqlCommand("wokao", con);
        try
        {
            con.Open();
             = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(com);
            DataSet ds = new DataSet();
            da.Fill(ds);
            dls.DataSource = ds.Tables[0];
            con.Close();
        }
存储过程
create procedure wokao --执行查询
    
    as
    select * from Blog
    return

加载
protected void Page_Load(object sender, EventArgs e)
    {
        DB.woako(this.DataList1);
        this.DataList1.DataBind();
    }

数据库有数据,问题是运行了无数据显示,帮个忙,3Q
4 回复
#2
hebingbing2008-05-14 21:02
SqlDataAdapter da = new SqlDataAdapter(com,con);
#3
狂砍程序2008-05-15 20:31
SqlCommand com = new SqlCommand("wokao", con);
我的com已经连接过了啊,SqlDataAdapter不是只要在连接com就行了吗,难道还要连接一次数据库?
#4
hebingbing2008-05-15 20:49
奥……
对不起,我没有看清楚……
实在对不起……
呵呵……
#5
狂砍程序2008-05-17 02:34
没关系啊,已经解决了谢谢
1