public static void Read_VoteBasic( int vbid, out DataTable dt) |
{ |
dt = new DataTable(); |
try |
{ |
using (SqlConnection conn = new SqlConnection(strConn)) |
{ |
SqlCommand cmd = new SqlCommand( "Read_VoteBasic" , conn); |
cmd.CommandType = CommandType.StoredProcedure; |
SqlParameter spvoteid = new SqlParameter( "@pVoteID" , SqlDbType.Int); |
spvoteid.Value = vbid; |
cmd.Parameters.Add(spvoteid); |
conn.Open(); |
using (SqlDataAdapter sda = new SqlDataAdapter()) |
{ |
sda.SelectCommand = cmd; |
sda.Fill(dt); |
} |
conn.Close(); |
} |
} |
catch (Exception) |
{ |
dt = null ; |
//throw; |
} |
} |
尽量避免使用 out |