值得学习的nonquery()代码

C# code
   
   
   
   
public int Execute( string strCommandText, List < object [] > paraList, CommandType type) { using (SqlConnection conn = new SqlConnection(strConnectionString)) { conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = strCommandText; cmd.CommandType = type; if (paraList != null && paraList.Count > 0 ) { for ( int i = 0 ; i < paraList.Count; i ++ ) { SqlParameter para = cmd.CreateParameter(); para.ParameterName = ( string )paraList[i][ 0 ]; para.Value = paraList[i][ 1 ]; cmd.Parameters.Add(para); } } return cmd.ExecuteNonQuery(); } }

你可能感兴趣的:(String,cmd,C#,null)