CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Updating values in Oracle


    Hi there!

    Have a problem with updating records in oracle :
    i am using RDO to access oracle data. My sample code as follows

    Dim env As rdoEnvironment
    Dim con As rdoConnection
    Dim rs As rdoResultset

    Private Sub Form_Load()

    Set env = rdoEngine.rdoEnvironments(0)
    env.CursorDriver = rdUseOdbc
    Set con = env.OpenConnection("", rdDriverNoPrompt, False, "uid=scott;pwd=tiger;dsn=oracledata")
    SSQL = "select * from dept"
    Set rs = con.OpenResultset(SSQL, rdOpenDynamic, rdConcurRowVer)
    SSQL = "select empno,ename,sal,comm,deptno from emp"
    Set rs1 = con.OpenResultset(SSQL, rdOpenDynamic, rdConcurRowVer)
    Text1.Text = rs!deptno
    Text2.Text = rs!dname
    Text3.Text = rs!Loc
    End Sub

    Private Sub CommandEdit_Click()
    rs.Edit
    End Sub
    Private Sub CommandAddnew_Click()
    rs.addnew
    End Sub

    Private Sub CommandSave_Click()
    rs!deptno = Text1.Text
    rs!dname = Text2.Text
    rs!Loc = Text3.Text
    rs.Update
    End Sub

    problem is when i say rs.edit and update record it's giving error:
    Run time error 40002
    IM006:[MICROSOFT][ODBC Drivers Manager] Drivers sqlsetconnectAttr failed

    but when i add new record it's inserting records without any problem
    I am using VB5 and ORACLE8 Client
    And the same code is working good in Personal Oracle7.3

    Thanks in advance!


  2. #2
    Join Date
    Aug 1999
    Posts
    4

    Re: Updating values in Oracle

    Hi
    The Error Code is basically for the error in Connection object.
    Try with DSN-less Connection as:

    rdoenvironment(0).OpenConnection("",rddrivernoprompt,false,"server=oracledata;Driver={Microsoft ODBC for Oracle};uid=scott;pwd=tiger"



    I don't know the default cursor type in RDO ,is it Readonly ?
    I hope it will help you



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured