请问各位高手,在VB中用ADO的connection的对象执行execute "input...."时,(如:con.execute="input 表名 values(值1,值2,...)")怎样知道执行是否成功?

解决方案 »

  1.   

    你在执行前面加一个错误扑捉:
    ON ERROR GOTO ERRINSSQL=“INSERT INTO 表名() VALUES()“
    CON。EXECUTE SQLEXIT SUB
    ERRINS:
      

  2.   

    con.execute="insert 表名 values(值1,值2,...)"
    if err.number=0 then
    成功
    else
    end if
      

  3.   

    dim id as integer
    connection.execute "insert into table ()values",id
    if id = 0 then
       msgbox("未插入")
    else
       msgbox("插入id条记录")
    end if
    id 用来返回sql语句的执行记录
      

  4.   

    err.number=0
    connection.execute "insert into table ()values",id
    if id>0 and err.number=0 then
      msgbox "成功"
    else
    1
    end if
      

  5.   

    xing0091() 的处理方法是正确的,这是一个ADO的方法。>>dim id as integer
    >>connection.execute "insert into table ()values",id
    >>if id = 0 then
    >>   msgbox("未插入")
    >>else
    >>   msgbox("插入id条记录")
    >>end if
    >>id 用来返回sql语句的执行记录
    有时是逻辑上的错误,用错误捕足的方法是不行的
      

  6.   

    不同意minajo21(大眼睛) ( ) 
    错误捕捉代码请参考connection的errors集合。以上回复均不完全。