Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Seeking a brilliant idea to replace NextID() function
Message
From
21/01/2008 13:21:30
Suhas Hegde
Dental Surgeon
Sirsi, India
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01283680
Message ID:
01283747
Views:
16
>
>DO CASE
>   CASE oApp.oVar.DBTYPE = DBTYPE_NATIVE
>        BEGIN TRANSACTION
>   CASE oApp.oVar.DBTYPE = DBTYPE_SQL
>        SQLSETPROP(oApp.oVar.sqlHandler,"Transactions",DB_TRANSMANUAL)
>        IF SQLEXEC(oApp.oVar.sqlHandler,[BEGIN TRANSACTION]) < 0
>           ASSERT .f.
>        ENDIF
>ENDCASE
>IF m.lnRetVal
>   DO CASE
>      CASE oApp.oVar.DBTYPE = DBTYPE_NATIVE
>           END TRANSACTION
>      CASE oApp.oVar.DBTYPE = DBTYPE_SQL
>           SQLEXEC(oApp.oVar.sqlhandler,[COMMIT TRANSACTION])
>           SQLSETPROP(oApp.oVar.sqlHandler,"Transactions",DB_TRANSAUTO)
>   ENDCASE
>
Hi Boris ,
Please Check this out
lccon = [DRIVER=SQL Server Native Client 10.0;Server=nagaveni\sql2008;Trusted_Connection=Yes]
han = SQLSTRINGCONNECT(lccon)

SQLEXEC(han,"create table #foo (f1 int,f2 char(20))")
 SQLEXEC(han,"select * from #foo ",'foo')
  
CURSORSETPROP("Tables","#foo","foo")
CURSORSETPROP("UpdateNameList", "f1 #foo.f1, f2 #foo.f2")
CURSORSETPROP("KeyFieldList", "F1")
CURSORSETPROP("UpdatableFieldList", "f1,f2")
CURSORSETPROP("SendUpdates", .T.)

 FOR m.xi = 65 TO 90
 INSERT INTO foo VALUES (m.xi,REPLICATE(CHR(m.xi),10))
  ENDFOR

SQLSETPROP(han,"Transactions",2)
SQLEXEC(han,"BEGIN TRANSACTION")

IF TABLEUPDATE(.t.,.t.,"foo",fooerror)
Messagebox("records with Begin transaction and SQLSETprop transaction")
SQLEXEC(han,"select * from #foo ",'foo1')
brow

SQLSETPROP(han,"Transactions",1) 
Messagebox("records with Begin transaction ")
SQLEXEC(han,"select * from #foo ",'foo1')
brow

SQLEXEC(han,"ROLLBACK TRANSACTION")
Messagebox("records with ROLLBACK TRANSACTION")
SQLEXEC(han,"select * from #foo ",'foo1')
 brow
ELSE
DISPLAY MEMORY LIKE fooerror
ENDIF
Do you need SQLSETPROP(oApp.oVar.sqlHandler,"Transactions",DB_TRANSMANUAL)

Suhashegde
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform