I
inadsad
Dear Group,
I have a store procedure with 12 input parameter and 2 output
parameters I'm wondering what's the best way to simplify the
following routine. I'd like to eliminate extra line of codes, do I
need to define input direction for each input parameter? I'm using
VS2005. I'd appreciate any useful feedback.
Thank You
Ian Nads
-------------------------------------------
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@CustID", SqlDbType.Int))
Sqlparam.Direction = ParameterDirection.Input
Sqlparam.Value = CustomerID
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@inAddr1", SqlDbType.VarChar))
Sqlparam.Direction = ParameterDirection.Input
Sqlparam.Value = Address1
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@inAddr2", SqlDbType.VarChar))
Sqlparam.Direction = ParameterDirection.Input
Sqlparam.Value = Address2
...
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@ID", SqlDbType.int))
Sqlparam.Direction = ParameterDirection.Output
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@ID2", SqlDbType.int))
Sqlparam.Direction = ParameterDirection.Output
' excecute store procedure
SqlComm.ExecuteNonQuery()
ID = SqlComm.Parameters(13).Value
ID2 = SqlComm.Parameters(14).Value
-------------------------------------------
I have a store procedure with 12 input parameter and 2 output
parameters I'm wondering what's the best way to simplify the
following routine. I'd like to eliminate extra line of codes, do I
need to define input direction for each input parameter? I'm using
VS2005. I'd appreciate any useful feedback.
Thank You
Ian Nads
-------------------------------------------
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@CustID", SqlDbType.Int))
Sqlparam.Direction = ParameterDirection.Input
Sqlparam.Value = CustomerID
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@inAddr1", SqlDbType.VarChar))
Sqlparam.Direction = ParameterDirection.Input
Sqlparam.Value = Address1
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@inAddr2", SqlDbType.VarChar))
Sqlparam.Direction = ParameterDirection.Input
Sqlparam.Value = Address2
...
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@ID", SqlDbType.int))
Sqlparam.Direction = ParameterDirection.Output
Sqlparam = SqlComm.Parameters.Add(New
SqlClient.SqlParameter("@ID2", SqlDbType.int))
Sqlparam.Direction = ParameterDirection.Output
' excecute store procedure
SqlComm.ExecuteNonQuery()
ID = SqlComm.Parameters(13).Value
ID2 = SqlComm.Parameters(14).Value
-------------------------------------------