From: TW on
Hi,

I use VO2.7B, MySQL 5.1 and VO2ADO.

I use AdoServer:FieldGet and it works, but if I use AdoServer:FieldPut
and it does not work.

I set adLockOptimistic in AdoServer and the file is not Read Only.
Just wonder what's wrong with it.

I can use AdoCommand to specify the SQL statment and do the updating,
but it's not convenient. If I can use DBF syntax FieldPut / Assign, it
will be much easier.

Any suggestion.

Thanks.

Tyrone
From: Geoff Schaller on
Tyrone,

You say it doesn't work but you didn't show us either the code you used,
the connection string or the error message.

We need something more to go on. You are probably using a client side
cursor which cannot be updated.

Also, whilst FieldPut may be convenient, it is also VERY slow. Writing
your own Fieldput override is more appropriate than using dynamic or
updatable cursors.

Geoff



"TW" <TYRONEWU(a)LIVE.COM> wrote in message
news:dea40a15-5e36-4377-89c4-5a90a04533df(a)t26g2000prt.googlegroups.com:

> Hi,
>
> I use VO2.7B, MySQL 5.1 and VO2ADO.
>
> I use AdoServer:FieldGet and it works, but if I use AdoServer:FieldPut
> and it does not work.
>
> I set adLockOptimistic in AdoServer and the file is not Read Only.
> Just wonder what's wrong with it.
>
> I can use AdoCommand to specify the SQL statment and do the updating,
> but it's not convenient. If I can use DBF syntax FieldPut / Assign, it
> will be much easier.
>
> Any suggestion.
>
> Thanks.
>
> Tyrone

From: TW on
Hi Geoff,

>>You say it doesn't work but you didn't show us either the code you used,
the connection string or the error message.

There is no error message. It seems that nothing has been done for the
FieldPut statement.

The coding is listed as follows :

LOCAL oConn AS AdoConnection
LOCAL oSrv AS AdoServer
LOCAL oCmd AS AdoCommand
LOCAL oRS AS AdoRecordSet

oConn := AdoGetConnection()
IF oConn == NULL_OBJECT
oConn := AdoConnection{}
oConn:ConnectionString := "Provider=MySQL Provider;Data
Source=localhost;" + ;
"User Id=root;Password=1234; Initial
Catalog=MYSQL_DB;"
oConn:Properties:[Item,"Prompt"]:Value := AdPromptComplete
oConn:Open(NIL,NIL,NIL,NIL)
oConn:CursorLocation := AdUseClient
AdoSetConnection(oConn)
ENDIF

oSrv := AdoServer{"MYSQL_TABLE",oConn,adOpenKeyset,
adLockOptimistic,adCmdTable}

oSrv:GoBottom()
oSrv:RLOCK()
oSrv:FIELDPUT(#field1,"NEW VALUE")
oSrv:Commit()

>>We need something more to go on. You are probably using a client side
cursor which cannot be updated.

Should I use oConn:CursorLocation := AdUseServer ?

>>Also, whilst FieldPut may be convenient, it is also VERY slow. Writing
your own Fieldput override is more appropriate than using dynamic or
updatable cursors.

Should I use

LOCAL oCmd AS AdoCommand

oCmd := AdoCommand{}
oCmd:ActiveConnection := oConn
oCmd:CommandText := "UPDATE MySQL_TABLE SET field1='NEW VALUE'
WHERE ...."
oCmd:CommandType := AdCmdText
oCmd:Execute(NIL, NIL,NIL)

Is this a better approach ?
I do think that this is really clumsy.

Thanks.

Tyrone
From: Geoff Schaller on
Tyrone.

From what little I know of MySQL, the cursor you are using is not
updatable. You will need to get the documentation for MySQL to know for
sure but in MS SQL, this would also be the case.

Generally you want to cache on the client so that means it us usually
better to use an UPDATE statement, understanding that this is a little
more code intensive. But it gives you much greater performance and lots
more control.

Cheers,

Geoff



"TW" <TYRONEWU(a)LIVE.COM> wrote in message
news:6ed1245f-e8a8-4a2e-92ea-6e99120be5d9(a)t34g2000prd.googlegroups.com:

> Hi Geoff,
>
>
> >>You say it doesn't work but you didn't show us either the code you used,
>
> the connection string or the error message.
>
> There is no error message. It seems that nothing has been done for the
> FieldPut statement.
>
> The coding is listed as follows :
>
> LOCAL oConn AS AdoConnection
> LOCAL oSrv AS AdoServer
> LOCAL oCmd AS AdoCommand
> LOCAL oRS AS AdoRecordSet
>
> oConn := AdoGetConnection()
> IF oConn == NULL_OBJECT
> oConn := AdoConnection{}
> oConn:ConnectionString := "Provider=MySQL Provider;Data
> Source=localhost;" + ;
> "User Id=root;Password=1234; Initial
> Catalog=MYSQL_DB;"
> oConn:Properties:[Item,"Prompt"]:Value := AdPromptComplete
> oConn:Open(NIL,NIL,NIL,NIL)
> oConn:CursorLocation := AdUseClient
> AdoSetConnection(oConn)
> ENDIF
>
> oSrv := AdoServer{"MYSQL_TABLE",oConn,adOpenKeyset,
> adLockOptimistic,adCmdTable}
>
> oSrv:GoBottom()
> oSrv:RLOCK()
> oSrv:FIELDPUT(#field1,"NEW VALUE")
> oSrv:Commit()
>
>
> >>We need something more to go on. You are probably using a client side
>
> cursor which cannot be updated.
>
> Should I use oConn:CursorLocation := AdUseServer ?
>
>
> >>Also, whilst FieldPut may be convenient, it is also VERY slow. Writing
>
> your own Fieldput override is more appropriate than using dynamic or
> updatable cursors.
>
> Should I use
>
> LOCAL oCmd AS AdoCommand
>
> oCmd := AdoCommand{}
> oCmd:ActiveConnection := oConn
> oCmd:CommandText := "UPDATE MySQL_TABLE SET field1='NEW VALUE'
> WHERE ...."
> oCmd:CommandType := AdCmdText
> oCmd:Execute(NIL, NIL,NIL)
>
> Is this a better approach ?
> I do think that this is really clumsy.
>
> Thanks.
>
> Tyrone