提问人:Khayal Ads 提问时间:11/14/2023 最后编辑:XedniKhayal Ads 更新时间:11/14/2023 访问量:40
向 Datatable 函数添加参数
Add parameter to Datatable function
问:
我想在DataGridView中显示过程结果并从Combobox获取参数值
我创建了一个名为Report_with_depo
Create proc [dbo].[Report_with_depo]
@customer_id nvarchar (50)
AS
select customer_id ,customer_fullname, amount_withdraw ,amount_deposit ,entry_date
from Oprations b
inner join Customers a
on b.customer_id2 = a.customer_id
where customer_id = @customer_id
和数据表函数
public DataTable Report_with_depo()
{
DAL.DataAccessLayer DAL = new DAL.DataAccessLayer();
DAL.Open();
DataTable dt = new DataTable();
dt = DAL.SelectData("Report_with_depo", null);
return dt;
}
显示按钮代码就像
this.dgv_Report.DataSource = Report_con.Report_with_depo();
我已经测试了我的代码并将参数替换为它有效的值,但现在我想从 Combobox 中获取值
答: 暂无答案
评论
DAL.SelectData
DAL.SelectData("Report_with_depo", new[]{ new SqlParameter("@customer_id", SqlDbType.NVarChar, 50) { Value = someValueHere } ) })