类管理-1
sql语句:
insert into table () values ()
update table set a= @a,b= @b where ID = @ID
delete from table where Id = @Id
执行命令
public static int ExecuteNonQuerty(DbCommand command)
{
int a = -1;
try
{
command.connection.Open();
a = command.ExecuteNonQuery():
}
catch (Exception Ex)
{
throw Ex.ToString();
}
finally
{
command.connection.Close();
}
return a;
}
判断是否执行成功
public static bool update(DbCommand command)
{
int result = -1;
try
{
result = DB.ExecuteNonQuery(command)
}
catch
{
}
return (result!=-1);
}
浙公网安备 33010602011771号