updating table from ODBC

updating table from ODBC

Postby xhbcoder » Mon Dec 18, 2006 10:22 pm

Hi all,

I am trying to update table from clipper through FiveODBC. I can't find sample codes to initiate the update from the documentation.

Thanks,

Jose
xhbcoder
 
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Postby Antonio Linares » Tue Dec 19, 2006 11:56 am

Jose,

Do you mean that you want to issue a SQL UPDATE command or that you want to update the DBF from the ODBC, or viceversa ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xhbcoder » Tue Dec 19, 2006 4:13 pm

Antonio,

I am trying to update SQL table from Clipper/FiveODBC. Also want to execute stored procedure from Clipper/FiveODBC.

Thanks,

Jose
xhbcoder
 
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Postby Antonio Linares » Tue Dec 19, 2006 4:29 pm

Jose,

To update a field simply assign it as you do in Clipper:

fieldName1 := newValue1
fieldName2 := newValue2
...
oRdd:oOdbc:Update( .T. )

Please review Class TRddODbc and Class TODBC Methods PutValue() to see how it works.

You can also issue a generic SQL UPDATE command using oRdd:oOdbc:Execute( "UPDATE ... " )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xhbcoder » Thu Dec 21, 2006 2:29 am

Antonio,

Thanks, I was able to update the first record but I am getting an error with the skip method.

Regard,

jose
xhbcoder
 
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Postby Antonio Linares » Thu Dec 21, 2006 8:15 am

Jose,

> I am getting an error with the skip method.

What error do you get ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xhbcoder » Thu Dec 21, 2006 3:59 pm

I am getting a GPF error. Thanks

********************
function ODBC_update && testing update
********************
local oRdd,afiles,n:=0,cTable,oDbf
oRdd := TRddOdbc():New("rtl_polling", "SA", "*****")
*oRdd := TRddOdbc():New("Northwind", "SA", "*****")
If !oRdd:oOdbc:lSuccess
oRdd:oOdbc:ShowErrorList("ODBC session not successfully initialized, aborting...")
oRdd:End()
return nil
Endif

// oRdd:oOdbc:lAbort := .f.
aFiles := oRdd:oOdbc:GetTables("*", .F. ) && returns all tables

if len(aFiles) == 0
MsgAlert("There are not tables on that database, aborting...",;
"ODBC Table selection")
oRdd:End()
return nil
endif
cTable := "test_jd"
oRdd:oOdbc:lCsrDyn := .t.
alert("here")
USE (cTable) VIA "ODBC" NEW ALIAS "_"+cTable+"_"
oDbf:=oRdd:getTable(cTable)
field->Field3="testxx"
oRdd:Skip(1)
field->Field3="test3"
*field->Field3="test update2"
*do while n <= 10
* n++
* oRdd:oOdbc:append()
* field->field2=n
*enddo
browse()
oRdd:End()
return nil
Last edited by xhbcoder on Thu Dec 21, 2006 7:02 pm, edited 1 time in total.
xhbcoder
 
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Postby Antonio Linares » Thu Dec 21, 2006 5:51 pm

Have you located on what source code line the GPF ocurrs ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xhbcoder » Thu Dec 21, 2006 9:09 pm

antonio,

Thanks for the quick reply.

The GPF occurs at oRdd:Skip(1) && <-- GPF error here

and and cAliasname line 0 when I close the Browse.

Any idea?

regards,

jose
xhbcoder
 
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Postby Antonio Linares » Thu Dec 21, 2006 11:06 pm

Jose,

You should place some traces (MsgInfo() calls) at METHOD Skip( nRecs ) CLASS TDbOdbc to see where it is failing (source\classes\tdbodbc.prg)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xhbcoder » Fri Dec 22, 2006 5:04 pm

Antonio,

I wonder why it may fail inside Fivewin class. Kindly check if I have the correct environment.

Clipper5.2e
Comix
FW24
Windows Xp Professional service pack2
MS SQL server 2005

I use xbase skip command to move records and looks working fine so far.

Regards,
Jose
xhbcoder
 
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Postby xhbcoder » Fri Dec 22, 2006 5:22 pm

Antonio,

Furthermore, even the Fivewin Browse New Button generates a [#8101] class:23000 error message followed by a GPF. The same with xbase append blank command.

Thanks,

Jose
xhbcoder
 
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Postby Antonio Linares » Fri Dec 22, 2006 5:36 pm

Jose,

Your FW is a quite an old version, though your environment looks ok.

As we have publically commented several times, we have focused on FWH and ODBC 32 bits support instad of FiveODBC RDD 16 bits, thats why we have not done further development on it. Most of our users are using FWH 32 bits.

Using Harbour and xHarbour we don't need to hack Clipper, as now full source code is available for development. We strongly recommend you to port your application to FWH 32 bits.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby xhbcoder » Wed Dec 27, 2006 4:08 pm

Antonio,

Thanks for the reply. Currently I have FW 2.4 for xhharbour but if it is not enough I will upgrade to the latest.

thanks again.

Jose
xhbcoder
 
Posts: 100
Joined: Wed Oct 04, 2006 4:50 pm
Location: USA

Postby Antonio Linares » Thu Dec 28, 2006 8:18 am

Jose,

FWH 2.4 is an old version, you should upgrade to FWH 6.12 (current one).
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42117
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 3 guests