reader =myCommand.ExecuteReader() ;

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/25 01:51:18
reader=myCommand.ExecuteReader();reader=myCommand.ExecuteReader();reader=myCommand.ExecuteReader();E

reader =myCommand.ExecuteReader() ;
reader =myCommand.ExecuteReader() ;

reader =myCommand.ExecuteReader() ;
ExecuteReader()----执行命名,返回一个类型化的 IDataReader
简化代码如下:
using (SqlConnection conn = new SqlConnection(connString))
{
string sqlString = "proc_InsertNewContact";
SqlCommand sqlCmd = new SqlCommand(sqlString,conn);
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.AddWithValue("@AddressLine1",mAddressLine1);
conn.Open();
SqlDataAdapter sqlreader = sqlCmd.ExecuteReader();
conn.Close();
}