Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating Records in an MS SQL CE Database
Message
From
26/05/2009 16:29:37
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01401914
Message ID:
01402074
Views:
58
>>I am trying to insert records into a .net local data table (SQL Compact Edition .sdf File)
>>
>>I am using a cursor adapter since these is no ODBC driver for this.
>>
>>I can open the table just fine but I cannot get an insert to work. Is it possible to insert into an ADO table?
>>
>>This is what is being returned by aerror after the tableupdate()
>>
>> ( 1, 1) N 1435 ( 1435.00000000)
>> ( 1, 2) C "Microsoft Cursor Engine : Multiple-step operation generated errors. Check each status value."
>
>John,
>
>Check this message #1398510 and the whole thread (you may check John's sample for mobile app too).

Where is that article located? (If it's here, search bombed out.)

I had been using the designer, but I converted this to code:

I've never manually done an insert command in a CA before, so it's probable that I messed that up.
CLEAR
local loConnDataSource
loConnDataSource = createobject('ADODB.Connection')
loConnDataSource.ConnectionString = [provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=C:\MailDat.sdf]
loConnDataSource.Open()
lodo = CreateObject("CursorAdapter")
lodo.Alias = "Test"
lodo.DataSourceType="ADO"
lodo.DataSource = createobject('ADODB.RecordSet')
lodo.DataSource.CursorLocation   = 3  && adUseClient
lodo.DataSource.LockType         = 3  && adLockOptimistic
lodo.DataSource.ActiveConnection = loConnDataSource
lodo.DataSource.CursorLocation   = 3  && adUseClient

DO CASE
  CASE .F.
    *Microsoft Cursor Engine : Multiple-step operation generated errors. Check each status value
    lodo.CursorSchema = "ID I, VAL I"
    lodo.UpdatableFieldList = "ID, VAL"
    lodo.UpdateNameList = "ID Test.ID, VAL Test.VAL"
    lodo.Tables = "Test"
    lodo.KeyFieldList ="ID"
  CASE .T.
    ** Cannot insert an empty row from a view or CursorAdapter into its base table(s).
    lodo.InsertCmd="insert into Test (Val) Values (?Test.Val)"
ENDCASE

lodo.SelectCmd="select * from Test"
lodo.CursorFill()

INSERT INTO Test (Val) VALUES (2)

? TABLEUPDATE()
=aerror(a)
LIST MEMORY LIKE a TO temp.txt

TRY
  CLOSE DATABASES ALL
CATCH
  =aerror(a)
  LIST MEMORY LIKE a 
  ? TABLEREVERT()
  CLOSE DATABASES ALL
ENDTRY
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform