Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Begin Transaction
Message
From
28/09/2016 07:34:49
 
 
To
28/09/2016 07:27:08
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01641395
Message ID:
01641441
Views:
40
>They only work against VFP data, not SQL Server.


well, sir then how to make these commands workable with sqlserver?
What changes should I made in the following commands

Please help
begin transaction
sqlsetprop(m.con, "Transactions",2)

lok=.t. && variable to dectect error

cmd="delete from crpr_sum where date=?Thisform.text3.Value and vou_no=?Thisform.text1.Value"
if sqlexec(con,cmd)<0
	aerror(laerror)
	messagebox(laerror[1,2])
	lok=.f.
	return.f.
endif


cmd="select MAX(vou_no)as max_sno from crpr_sum where date=?thisform.text3.Value"
if sqlexec(con,cmd,'table1')<0
	aerror(laerror)
	messagebox(laerror[1,2])
	return.f.
else
	select table1
	thisform.text1.value=nvl(max_sno,0)+1
endif


text TO m.cmd NOSHOW TEXTMERGE 
INSERT INTO crpr_sum(
vou_no,date,vou_type,acc_code,acc_name,sales_r,vehicle_no,bilty_no,tpt,
driver,cr_amount,dr_amount)
values(
?Thisform.text1.Value,?thisform.text3.value,'PR',?thisform.text10.value,
?thisform.text11.value,?thisform.text13.value,?thisform.text14.value,
?thisform.text15.value,?thisform.text16.value,?thisform.text2.value,
?thisform.text22.value,0)
ENDTEXT

if sqlexec(m.con,cmd)<0
	aerror(laerror)
	messagebox(laerror[1,2])
	lok=.f.
endif

if 	lok=.f.
	sqlrollback(m.con)
	rollback
else
	if sqlcommit(m.con)<0
		aerror(laerror)
		messagebox(laerror[1,2])
		rollback
	else
		end transaction
	endif
	sqlsetprop( m.con,"Transactions",1)
endif
Previous
Reply
Map
View

Click here to load this message in the networking platform