从Sql Server存储过程填充数据集? [英] fill dataset from Sql Server stored procedure?
问题描述
我在Sql Server2k上有一个存储过程。我可以填充一个数据表,我可以使用ADODB记录集对象附加到数据集,该对象从运行sp的命令对象中填充
。我希望使用DataAdapter。
但我认为数据适配器只使用select语句。我可以在我的vb.net应用程序中编写
sp,但sp引用了我在Sql Sever中编写的UDF。我想b / b
会猜测我需要坚持使用ADODB记录集对象
这个。但我对如何使用存储过程中的数据填充
数据表/数据集提出了更好的建议。
谢谢,
Rich
好的。现在我记得我的困境。 ADO.Net不使用记录集对象。那么
如何从存储过程填充我的数据表/数据集?
Rich写道:
我在Sql Server2k上有一个存储过程。我可以填充一个数据表,我可以使用ADODB记录集对象附加到数据集,该对象从运行sp的命令对象中填充。我希望使用DataAdapter。
但我认为数据适配器只使用select语句。我可以在我的vb.net应用程序中编写
sp,但sp引用了我在Sql Sever中编写的UDF。我猜想我需要坚持使用ADODB记录集对象来实现这个目标。但是我对如何使用存储过程中的数据填充
数据表/数据集提出了更好的建议。
谢谢,
Rich>
当然是SqlDataReader。这一切都回到我身边。这一段时间还没有完成
。实际上,我想用这个填充数据网格。所以我想我将从Reader对象中填充数据表并将
datagrid数据源设置为数据表。我在这里吗?读者可以使用
作为数据源吗?
" Rich"写道:
好的。现在我记得我的困境。 ADO.Net不使用记录集对象。那么
如何从存储过程中填充我的数据表/数据集?
Rich写道:
我在Sql Server2k上有一个存储过程。我可以填充一个数据表,我可以使用ADODB记录集对象附加到数据集,该对象从运行sp的命令对象中填充。我希望使用DataAdapter。
但我认为数据适配器只使用select语句。我可以在我的vb.net应用程序中编写
sp,但sp引用了我在Sql Sever中编写的UDF。我猜想我需要坚持使用ADODB记录集对象来实现这个目标。但我对如何使用存储过程中的数据填充
数据表/数据集提出了更好的建议。
感谢,
Rich
>如何从存储过程中填充数据表/数据集?
您好,
我不是专家,但设置了CommandType
到StoredProcedure。
CommandText到您的StoredProc名称。
我希望使用DataAdapter。
但我认为这些数据适配器只使用select语句
DataAdapter有Select,Insert和Delete语句。
然后,DataAdapter.Fill(DataTable)
当然,Connection必须是开放的。
希望有所帮助,
Roger
I have a stored procedure on Sql Server2k. I can fill a data table which I
can append to a dataset using an ADODB recordset object which gets populated
from a command object that runs the sp. I was hoping to use a DataAdapter.
But I think the data adapter only uses select statements. I could write the
sp in my vb.net app, but the sp references UDF''s I wrote in the Sql Sever. I
will guess that I will need to stick with the ADODB recordset object for
this. But I am open to any better suggestions on how to fill the
datatable/dataset with the data from the stored procedure.
Thanks,
Rich
OK. Now I remember my dilema. ADO.Net doesn''t use recordset objects. So
how can I fill my data table/dataset from a stored procedure?
"Rich" wrote:
I have a stored procedure on Sql Server2k. I can fill a data table which I
can append to a dataset using an ADODB recordset object which gets populated
from a command object that runs the sp. I was hoping to use a DataAdapter.
But I think the data adapter only uses select statements. I could write the
sp in my vb.net app, but the sp references UDF''s I wrote in the Sql Sever. I
will guess that I will need to stick with the ADODB recordset object for
this. But I am open to any better suggestions on how to fill the
datatable/dataset with the data from the stored procedure.
Thanks,
Rich
Of course, the SqlDataReader. It''s all coming back to me. Just haven''t done
this for a while. Actually, I want to populate a datagrid with this. So I
am thinkin I will populate the datatable from the Reader object and set the
datagrid datasource to the datatable. Am I on track here? can a reader be
used as a datasource?
"Rich" wrote:
OK. Now I remember my dilema. ADO.Net doesn''t use recordset objects. So
how can I fill my data table/dataset from a stored procedure?
"Rich" wrote:I have a stored procedure on Sql Server2k. I can fill a data table which I
can append to a dataset using an ADODB recordset object which gets populated
from a command object that runs the sp. I was hoping to use a DataAdapter.
But I think the data adapter only uses select statements. I could write the
sp in my vb.net app, but the sp references UDF''s I wrote in the Sql Sever. I
will guess that I will need to stick with the ADODB recordset object for
this. But I am open to any better suggestions on how to fill the
datatable/dataset with the data from the stored procedure.
Thanks,
Rich
> how can I fill my data table/dataset from a stored procedure?
Hi,
I am not an expert, but set the CommandType
to StoredProcedure.
CommandText to your StoredProc name.
I was hoping to use a DataAdapter.
But I think the data adapter only uses select statements
DataAdapter has Select, Insert and Delete statements.
Then, DataAdapter.Fill(DataTable)
Of course, Connection must be open.
Hope that helps,
Roger
这篇关于从Sql Server存储过程填充数据集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!