Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot Execute SP From OLEDB for ASP
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00686614
Message ID:
00686621
Views:
36
Could it be a pathing issue? Your stored procedure opens tables, but you should keep in mind that when using VFP through an ASP page there is not SET PATH in effect. There are also some other settings that you need to be aware of, like for example SET EXCLUSIVE.



>Problem with stored procedure code in a DBC. I have a database-bound table, and from inside the VFP IDE or inside a COM object or inside an EXE, my database-bound stored procedure gets the next available ID for my table primary key and use that in the insert. For some reason, when I do the same kind of insert from an ASP page, the stored procedure is not firing. Below is my DDL for creating the database, table, and dbkeys table. Then there's code that can be pasted into a .vbs or .asp and tried.
>
>Anybody?
>
>VFP7-SP1 , Win2K , IIS5 , ASP3
>
>
>
>
>Code to create VFP-side data:
>
>set collate to 'machine'
>create database 'e:\mydbc.dbc'
>create table 'e:\tablea.dbf' name 'tablea' ( ;
>author_id i null default autoinckey(left(justfname(dbf()),(len(justfname(dbf()))-4)),"author_id"), ;
>username c(20) null, ;
>user_code c(70) null, ;
>password c(20) null default "123456", ;
>author_email c(50) null default "unk", ;
>show_email l null default .f., ;
>homepage c(50) null default "http://@@@@@.@@@", ;
>location c(50) null default "[unk]", ;
>signature m null default "[unk]", ;
>no_of_posts i null default 0, ;
>join_date t null default datetime(), ;
>active l null default .t., ;
>status i null default 0, ;
>avatar c(100) null default "" ;
>)
>
>index on user_code tag user_code
>index on username tag username
>alter table 'tblauthor' add primary key author_id tag author_id
>
>create table 'e:\dbkeys.dbf' name 'dbkeys' ( ;
>ctable c(16) null, ;
>ccolumn c(16) null, ;
>inextid i null ;
>)
>index on inextid tag inextid
>index on upper(ctable) tag ctable
>index on upper(ccolumn) tag ccolumn
>
>
>
>Code that is inside the Stored Procedure block in the DBC:
>
>Function AutoIncKey
>LParameters pcTable,pcColumn
>	pcTable = Upper(pcTable)
>	pcColumn = Upper(pcColumn)
>	local lnArea, liRetVal
>	lnArea = select()
>	If !used("dbkeys")
>		Use ( "dbkeys" ) In 0 Shared
>		Select dbkeys
>		lNothing = CursorSetProp("Buffering",1)
>		Set Order To
>	Else
>		Select dbkeys
>	EndIf
>	Do While !FLock()
>	EndDo
>	Locate For Upper(cTable) = pcTable and Upper(cColumn) = pcColumn
>	If Found()
>		Replace iNextID With iNextID + 1
>		Flush
>		Unlock
>	Else
>		Insert Into dbkeys (cTable,cColumn,iNextID) Values (pcTable,pcColumn,1)
>		Flush
>		Unlock
>	EndIf
>	Select (lnArea)
>	liRetVal = dbkeys.iNextId
>Return liRetVal
>EndFunc
>
>Function Now
>	Set Date to American
>	Set Mark to "/"
>	tOutDT = Datetime()
>	Set Date to ANSI
>	Set Mark to "."
>Return tOutDT
>EndFunc
>
>
>
>The VBScript code that breaks:
>
>strCon = "Provider=VFPOLEDB.1;Data Source=E:\mydbc.DBC;Password="""";Collating Sequence=MACHINE"
>Set AdoCon = CreateObject("ADODB.Connection.2.7")
>With AdoCon
>	.ConnectionString = strCon
>	.CursorLocation = 2
>	.Mode = 16
>	.Open
>End With
>
>AdoCon.Execute("Insert Into tablea (UserName) Values ('steve')")
>
Hector Correa
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform