日期:2014-05-17  浏览次数:20524 次

求教高手.net如何向存储过程传递参数(数组)
存储过程中设置一个二维数组的参数 在.net 中如何向该存储过程传递二维数组参数并执行

请高手不吝赐教啊 !!!!
存储过程 传参 数组

------解决方案--------------------

SqlConnection pConn = new SqlConnection(connString);

SqlTransaction pTrans = null;

               [align=left] try
                {
                    pConn.Open();
                    pTrans = pConn.BeginTransaction();

                    using (SqlBulkCopy bcp = new SqlBulkCopy(pConn, SqlBulkCopyOptions.FireTriggers, pTrans))
                    {
                        bcp.DestinationTableName = "temp_" + tableName;
                        bcp.WriteToServer(data);
                    }

                    // 提交事务
                    pTrans.Commit();

                    pConn.Close();
                }
                catch (Exception ex)
                {
           
                        pTrans.Rollback();
                 }[/align]