CLOSE DATABASES all CLEAR ?VERSION() con=SQLCONNECT("LocalServer") && point to any available SQL Server IF con<1 ? "FAILED to connect!!!" RETURN ENDIF ?[SQLGetProp(con, "DispWarnings")],SQLGetProp(con, "DispWarnings") cConnString=SQLGETPROP(con,"ConnectString") SQLEXEC(con,"SET ANSI_PADDING ON") SQLEXEC(con,"DROP table testtransaction3") SQLEXEC(con,"create table testtransaction3 (f1 int, f2 char(10))") SQLSETPROP(con,"Transactions",2) SQLEXEC(con,"insert into testtransaction3 values(1,'11111')") SQLEXEC(con,"select @@TRANCOUNT as count", "trancount") ? "Current trancount:",trancount.count *SQLROLLBACK(con) && <==== uncomment this line to see the difference SQLSetProp(con, "DispWarnings", .T.) ?[SQLGetProp(con, "DispWarnings")],SQLGetProp(con, "DispWarnings") ? "Connection is disconnected!" ?[SQLDISCONNECT(con)=],SQLDISCONNECT(con) ? con=SQLSTRINGCONNECT(cConnString) ? "Connect again and query data" SQLEXEC(con,"select * from testtransaction3","currentstate") SELECT currentstate LIST ?[RECCOUNT()],RECCOUNT() SQLEXEC(con,"DROP table testtransaction3") SQLDISCONNECT(0)VFP output:
Visual FoxPro 08.00.0000.2521 for Windows SQLGetProp(con, "DispWarnings") .F. Current trancount: 1 SQLGetProp(con, "DispWarnings") .T. Connection is disconnected! SQLDISCONNECT(con)= 1 Connect again and query data Record# F1 F2 1 1 11111 RECCOUNT() 1Thanks,