日期:2014-05-18 浏览次数:20881 次
string cmdstr = "select code from table where code='" + code + "'" cn.Open(); SqlCommand cmd = new SqlCommand(cmdstr,cn); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { Console.Write("数据已存在"); } else { Console.Write("不存在"); }