本文介绍了强类型数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
强类型的数据集"正在使用具有参数的存储过程,如何在运行时将参数值传递给它.
Thanks
Hello,
"strongly typed DataSet" is using a stored procedure that has a parameter, how do i pass parameter value to it at run time.
thanks
推荐答案
Dim table as MyDataSet.PersonTable
Dim minimumAge as Int32 = 24
Dim maximumAge as Int32 = 40
Using ta as MyDataSetTableAdapters.PersonTableAdapter = _
new MyDataSetTableAdapters.PersonTableAdapter()
table = ta.GetData(minimumAge, maximumAge)
End Usingl
当您的存储过程仅返回标量值或根本不返回任何值时,将使用相同的原理.例如,当您的存储过程返回年龄范围内的人数时,如果在de QueriesTableAdapter中生成了一个方法.
The same principle will be used when your stored procedure only returns a scalar value or no value at all. For instance when your stored procedure returns the number of persons within a age range, if will generated a method in de QueriesTableAdapter.
Dim minimumAge as Int32 = 24
Dim maximumAge as Int32 = 40
Dim numberOfPersonWithinRage as Int32
Using ta as MyDataSetTableAdapters.QueriesTableAdapter = _
new MyDataSetTableAdapters.QueriesTableAdapter()
numberOfPersonWithinRange = ta.CountPersonsByAge(minimumAge, maximumAge)
End Using
当您在强类型数据集中使用带有参数的SQL语句时,将应用相同的逻辑.
When you use SQL statements with parameters in your strong typed datasets, the same logic will apply.
这篇关于强类型数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!