ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 类管理解析

类管理解析

原创 Linux操作系统 作者:iDotNetSpace 时间:2010-04-07 13:50:12 0 删除 编辑

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);

}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-631500/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-01-04

  • 博文量
    2376
  • 访问量
    5766262