Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update gives error

Status
Not open for further replies.

chris6user

Programmer
Dec 10, 2001
56
CA
here is my code:
Dim sSql As String
Dim sCon As ADODB.Connection
Dim sRs As ADODB.Recordset
Dim i As Integer


Set sCon = New ADODB.Connection
sCon.Open sConnect

Set sRs = New ADODB.Recordset
sSql = "Select * from geo_area where geo_id = -1"
sRs.Open sSql, sCon, adOpenDynamic, adLockPessimistic


sRs.AddNew
sRs!geo_id = 1
sRs!geo_code = "8"
sRs!name_eng = "test"
sRs!name_frn = "test"
sRs.Update

sRs.Close
sCon.Close

I am using Oracle8i.
when it comes to sRs.Update generates error:

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

????
 
Hi

May I suggest something simpler? (Assumption: sConnect
has been properly assigned elsewhere.)

Cassie

Code:
    Dim sSql As String
    Dim sCon As ADODB.Connection

    Set sCon = New ADODB.Connection
    sCon.Open sConnect
    sCon.CursorLocation = adUseClient
    
    sSql = "INSERT INTO [geo_area] (geo_id, geo_code, " & _
        "name_eng, name_frn) VALUES (1, '8', 'test', " & _
        "'test');"
    sCon.Execute sSql
       
    sCon.Close

 
try to replace

sRs.Open sSql, sCon, adOpenDynamic, adLockPessimistic

with

sRs.Open sSql, sCon, adOpenDynamic, adLockPessimistic,adCmdText

and then execute.
 
Probably a unique key issue.

First of all, update to MDAC 2.6+ if you haven't already.

Second, looking at this field:

sRs!geo_id = 1

I would think that it is a primary key.
Is this an Identity/Auto increment field?

If so, what happens if you do not set it?

There are several other possibilities.
[/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top