日期:2014-05-17 浏览次数:20891 次
string[] content = { "内容段1", "内容段2", "内容段3", "内容段4", "内容段5" };
foreach (string con in content)
{
sql = "select * from table where content='"+con+"'";
int i = ExecuteSql(sql);
if (i>0)
{
MessageBox.Show(con+"存在数据库中");
}
else
{
MessageBox.Show(con+"不存在数据库中");
}
}
//返回记录数
public static int ExecuteSql(string SQLString)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
using (SqlCommand cmd = new SqlCommand(SQLString, connection))
{
try
{
&n