public int ExecuteSql(string sql)
{
open();
if (conn == null) return 0;
int iResult = 0;
using (SqlCommand sqlcmd = new SqlCommand(sql, conn))
{
try
{
sqlcmd.CommandTimeout = 300;
sqlcmd.ExecuteNonQuery();
iResult = 1;
}
catch (Exception ex)
{
iResult = 0;
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
}
return iResult;
}
慕容森
慕尼黑5688855
SMILET
相关分类