create proc test_proAS
set nocount on
select * from answers
select * from msg
select * from tree
set nocount off conn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Connection"].ToString());
da=new SqlDataAdapter("test_pro",conn);
da.SelectCommand.CommandType=CommandType.StoredProcedure;
ds=new DataSet();
da.Fill(ds);
int count=ds.Tables.Count;//为什么这里的count没有数值,我希望得到的是ds里面有 table0,table1,table2。
set nocount on
select * from answers
select * from msg
select * from tree
set nocount off conn=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Connection"].ToString());
da=new SqlDataAdapter("test_pro",conn);
da.SelectCommand.CommandType=CommandType.StoredProcedure;
ds=new DataSet();
da.Fill(ds);
int count=ds.Tables.Count;//为什么这里的count没有数值,我希望得到的是ds里面有 table0,table1,table2。
解决方案 »
- 幻灯片 图片路径问题。。。
- 我在公司的机器上(内部IP,172.16.161.*)用iis发布一个站点,如何在外网访问它?
- CommandArgument和CommandName
- Gridview导出成Excel 有些列我不想要,该怎么弄?谢谢!!
- 给个DropDownList触发 查询的源码 学习学习 被
- 请问如何在页面中插入google的搜索??
- 如何建立一个跨 server的view ?
- 向高手请教,是否可以横向、竖向两个方向循环?
- 关于$(document).ready(function(){}) 一个容易被忽略的问题
- gridview 行双击事件后,传值并跳转新页面
- 为什么PlaceHolder控件不能添加多个控件?
- ??????RadioButtonList为什么一直选中的是第一项???
{
conn=new Speciality.Connection().Conn();
conn.Open();
da=new SqlDataAdapter("test_pro",conn);
da.SelectCommand.CommandType=CommandType.StoredProcedure;
ds=new DataSet();
da.Fill(ds);
int count=ds.Tables.Count;
}
catch(SqlException ex)
{
Speciality.JScript.Alert(ex.Message);
}
finally
{
conn.Close();
}
{
conn=new Speciality.Connection().Conn();
conn.Open();
da=new SqlDataAdapter("test_pro",conn);
da.SelectCommand.CommandType=CommandType.StoredProcedure;
ds=new DataSet();
da.Fill(ds);
int count=ds.Tables.Count;
}
catch(SqlException ex)
{
Speciality.JScript.Alert(ex.Message);
}
finally
{
conn.Close();
}
每个查询语句要用分句隔开:
sql="Select * from tables1;select * from tables;Update tables1 set aa=1"
Da=New SqlDataAdapter(sql,conn)
Da.Fill(Ds)
create proc test_proAS
set nocount on
select * from answers
select * from msg
select * from tree
set nocount off这里我的后台命令:
try
{
conn=new Speciality.Connection().Conn();
if(conn.State==System.Data.ConnectionState.Closed)
conn.Open();
da=new SqlDataAdapter("test_pro",conn);
da.SelectCommand.CommandType=CommandType.StoredProcedure;
ds=new DataSet();
da.Fill(ds);
DataGrid1.DataSource=ds.Tables["Table0"].DefaultView;
DataGrid1.DataBind();
int count=ds.Tables.Count;
}
catch(SqlException ex)
{
Speciality.JScript.Alert(ex.Message);
}
finally
{
if(conn.State==System.Data.ConnectionState.Open)
conn.Close();
}
为什么我的 ds.Tables["Table0"] 值为空啊?
table1 的记录数:ds.Tables(1).rows().count
select * from msg
select * from tree
你返回的3个表用SqlDataAdapter.Fill到一个DataSet中,这个应该很简单吧访问时候使用
DataTable dt1 = DataSet.Table[0]
DataTable dt2 = DataSet.Table[1]
DataTable dt3 = DataSet.Table[2]接着用DataRow[][]访问具体数据
ds.Tables[1]
ds.Tables[2]
AS
select * from aa
select * from bb
select * from ccthis.DataAdapter = new System.Data.SqlClient.SqlDataAdapter("test",this.Con);
this.DataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
this.DSet = new DataSet();
this.DataAdapter.Fill(this.DSet,"A");
MessageBox.Show(this.DSet.Tables.Count.ToString());Table1 A
Table2 A1
Table3 A2