that is the basic idea although I haven't tested that method yet so it may have a bug I should get to test it today though and I'll repost it if I find a bug. also look in the C# forum at my threade comments on SQL Server code for a big example. The only dif betwenn OleDb and SqlClient is the one you see when you read OleDB and SqlClient at least in usage.PHP Code:/// <summary>
/// Execute a nonquery stored procedure.
/// </summary>
/// <param name="commandText">Procedure name.</param>
/// <param name="param">Array of SqlParameters.</param>
/// <returns></returns>
public static int ExecuteNonQuery(string commandText, SqlParameter[] param)
{
SqlConnection conn = Connection;
SqlCommand cmd = new SqlCommand(commandText, conn);
cmd.CommandType = CommandType.StoredProcedure;
for(int i = 0; i < param.Length; i++)
{
cmd.Parameters.Add(param[i]);
}
return cmd.ExecuteNonQuery();
}




Reply With Quote