如何传递DataTable作为存储过程中的参数 [英] How to Pass DataTable As a parameter in stored Procedure
本文介绍了如何传递DataTable作为存储过程中的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我有一个数据表,我想将它作为参数传递给存储过程,用于更新表字段和插入新行。
你能不能建议我。?
Hi
I have a data table and i want to pass it to Stored procedure as Parameter, for update the table field and for insert new row.
Can you suggest me.?
推荐答案
DataTable dt = new DataTable();
TextBox txtdat = (TextBox)GVHolidays.Rows[e.RowIndex].Cells[1].Controls[1];
TextBox txtreason = (TextBox)GVHolidays.Rows[e.RowIndex].Cells[3].Controls[1];
//int st = Convert.ToInt32(GVHolidays.DataKeys[e.RowIndex].Values[0].ToString());
objHRPL.status = Convert.ToInt32(GVHolidays.DataKeys[e.RowIndex].Values[1].ToString());
objHRPL.username = Session["username"].ToString();
//objHRPL.sno = st;
IFormatProvider provider1 = new System.Globalization.CultureInfo("en-CA", true);
String dob = txtdat.Text.Trim().ToString();
DateTime datedob = DateTime.Parse(dob, provider1, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
objHRPL.dob = datedob;
objHRPL.remarks = txtreason.Text.ToString();
请参阅代码项目文章的简单示例 - 将数据表传递给SQL Server 2008中的存储过程 [ ^ ]。
Refer the Simple Example on the Code Project Article- Passing a datatable to a Stored Procedure in SQL Server 2008[^].
试试这个链接
http://stackoverflow.com/questions/12320594/passing-datatable-to-a-stored-procedure [ ^ ]
将数据表发送到存储过程 [ ^ ]
Try this links
http://stackoverflow.com/questions/12320594/passing-datatable-to-a-stored-procedure[^]
Sending a DataTable to a Stored Procedure[^]
这篇关于如何传递DataTable作为存储过程中的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文