create proc a
select * from b (没有where条件)C# 读取 存储过程 返回的结果集
select * from b (没有where条件)C# 读取 存储过程 返回的结果集
解决方案 »
- ASP.net与SQL2005网站上传到虚拟主机的疑惑???
- 求问大家如何Text='<%# Bind("zhuangtai") %>'>如何加入条件判断?
- CookieContainer的疑问,求高手!
- 一个关于DetailsView控件的问题急急需!!!!
- 同一页面根据条件显示不同的表修改,请各大大指教!!
- javascript返回值输出中文乱码,英文没事
- 动态创建数据库表格 哪位大侠帮忙看一下
- 求教数据库表中字段值转存二维数组的问题,在线等。。。。
- 急:后台跟前台结合来做开发的时候,怎么样才能更好的结合?下面有一个实例,大家帮分析一下,谢谢合作!
- 关于MultiPage控件
- asp.net 的服务器端Cookices可以被Javascript改掉吗?
- 值类型中的方法问题
{
conn.ConnectionString = ".........";
using (System.Data.SqlClient.SqlCommand command = conn.CreateCommand())
{
command.CommandText = "a";
using(System.Data.SqlClient.SqlDataAdapter adp=new System.Data.SqlClient.SqlDataAdapter(command))
{
System.Data.DataSet ds = new System.Data.DataSet();
adp.Fill(ds, "a");
}
}
conn.Close();
}
还是可以返回 datareader 或是 dataset
没有研究过啊 有人研究过这个东东?(如何得到 存储过程的结果集啊)
select * from b (没有where条件)
与直接的select * from b 楼主觉得有什么区别
执行存储过程.就可以得到结果呀.和普通的SQL没有区别吧
您在吗???amandag 2008年06月10日 13点07分11秒 说:
你打算取到哪里?qq137523133 2008年06月10日 13点08分47秒 说:
或者别的里也可以amandag 2008年06月10日 13点08分52秒 说:
要用存储过程?qq137523133 2008年06月10日 13点09分01秒 说:
对amandag 2008年06月10日 13点09分21秒 说:
打算是web程序里用还是winform应用程序里用qq137523133 2008年06月10日 13点09分37秒 说:
如果要存储过程取的话 那只是一条qq137523133 2008年06月10日 13点09分44秒 说:
webamandag 2008年06月10日 13点10分08秒 说:
不会的,返回的肯定是多条,你用的是VS2005么?qq137523133 2008年06月10日 13点10分41秒 说:
2008 2005 混用amandag 2008年06月10日 13点11分00秒 说:
那我2005给你写个例子qq137523133 2008年06月10日 13点11分19秒 说:
好的 谢谢了qq137523133 2008年06月10日 13点11分24秒 说:
好的 谢谢了amandag 2008年06月10日 13点14分22秒 说:
先创建存储过程
Create proc GetAuthors
as
select * from authors
goamandag 2008年06月10日 13点15分50秒 说:
using System.Data.SqlClient;
public partial class BB : System.Web.UI.Page
{
private void BindGrid()
{
//这里替换成你的连接字符串
SqlConnection cn = new SqlConnection(@"server=.\SQLExpress;uid=sa;pwd=password;database=pubs");
//GetAuthors是你的存储过程名字
SqlDataAdapter da = new SqlDataAdapter("GetAuthors", cn);
//指明查询的类型为存储过程,很重要
da.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
cn.Open();
da.Fill(ds);
cn.Close();
GridView1.DataSource = ds;
GridView1.DataBind();
} protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
BindGrid();
}
}
}amandag 2008年06月10日 13点16分07秒 说:
假设你的页面上有一个GridView控件qq137523133 2008年06月10日 13点16分41秒 说:
额```这么简单...amandag 2008年06月10日 13点17分07秒 说:
hehe,所以下面有人怀疑你倒分啊qq137523133 2008年06月10日 13点18分48秒 说:
麻烦您了amandag 2008年06月10日 13点19分16秒 说:
不麻烦,最重要的是要使用参数,不要拼接SQL语句qq137523133 2008年06月10日 13点19分38秒 说:
您有QQ 或者MSN吗呵呵 ,,,有太简单了 自己也吓一跳 没办法 在简单也是问题