#1  
Old 15th September 2007, 09:32 PM
Gary Naughton
 
Posts: n/a
Default V1.07 Insert & Add Record Failure

Hi Team,

I've tried two approaches to add records to Nexus tables with Nx ODBC driver
1.7 via VB6. Both fail?
Problem 1.
I cannot insert records via ADODB command object. Code runs fine (no errors
reported) but data doesn't appear in the table.
Problem 2.
I cannot add field data to a record after ADODB 'Addnew' command. Every
field throws error: (Multiple-step operation generated errors. Check each
status value.). Field types and length check out OK.

The relevant VB6 code I am using follows: (I have left out DIM's to simplfy)

'Nexus connection object
Set cnn2 = New ADODB.Connection
With cnn2
.Mode = adModeReadWrite
.ConnectionTimeout = 60
.Open gsConNXA 'gsConSQL
.CursorLocation = adUseClient
End With

'Nexus command object
Set cmdDoProcNx = New ADODB.Command
Set cmdDoProcNx.ActiveConnection = cnn2
cmdDoProcNx.CommandType = adCmdText
cmdDoProcNx.CommandTimeout = 60
'-----------------------------------------
'Open table for Adding Records. Tried various adOpen & adLock alternatives
QueryTxt = "SELECT * FROM RMCHANGE"
rstTempNx.Open QueryTxt, cnn2, adOpenKeyset, adLockBatchOptimistic,
adCmdText
'Although Addnew works: This attempt threw an error when attempting to
add data to any field.
With rstTempNx
.AddNew
.Fields("ClassID") = "ENB10SSKD"
.Fields("Date") = "17/09/2007"
.Fields("Slot") = 5
.Fields("Rm") = "IT2"
.Update
End With
'------------------------------------------
'Attempt to insert records via ADODB Command object
QueryTxt = "INSERT INTO ""RMCHANGE"" (""ClassID"", ""Date"", ""Slot"",
""Rm"") VALUES('" & !ClassID & "', '" & !Date & "', " & !Slot & ", '" & !Rm
& "')"
'Example of Literal QueryTxt string is:
'INSERT INTO "RMCHANGE" ("ClassID", "Date", "Slot", "Rm")
VALUES('INB09MSEA', '17/09/2007', 4, 'J04')
cmdDoProcNx.CommandText = QueryTxt
cmdDoProcNx.Execute
'This throws no error BUT data doesn't appear in the target table??

Regards,
Gary Naughton.




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid BLOB handle in record buffer Matthew Balraj nexusdb.public.support.adoprovider 1 15th February 2010 04:13 PM
Is it possible to record screen data on server side? Hannes Danzl[NDD] nexusdb.public.support.portal 9 9th February 2010 06:42 PM
Simple Delete Record Michael McConville nexusdb.public.support.adoprovider 5 24th June 2004 10:56 AM
ODBC driver does not retrieve the first record Jan-Erik Johansen nexusdb.public.support.odbc 8 22nd October 2003 02:48 AM
ODBQ Insert SQL Error Vojko Cendak nexusdb.public.support.odbc 0 17th October 2003 11:28 PM


All times are GMT +11. The time now is 11:19 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.