Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass a web variable to a stored procedure
Message
From
29/01/2008 08:20:29
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
28/01/2008 18:39:35
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
01257541
Message ID:
01286541
Views:
22
>>>And this one produces an unknown command error.
>>>
>>>   execstr = "EXEC 'create table c:\taffble1 (xfield1 c(20))'"
>>>   oConn.Execute(execstr)
>>>
>>>Which I don't understand either.
>>
>>Don,
>>I don't understand why I got a CC and I remember I showed you to do all that stuff as a stored procedure rather than EXEC.
>>Cetin
>
>Sorry Cetin. I copied you because you seemed interested in the original post. Actually I do have it working now as a stored procedure but I am exploring the possibilities of the EXEC command. Currently I am trying to insert a new record and return a value produced by an autoinc field. Something like
>
>execstr = "EXEC 'insert into users (name,username,password,authlevel,organization,email) values "
>execstr = execstr & "([Name],[UserName],0,[Organization],[email])'" & crlf
>execstr = execstr & "'return user_id'"
>
>lcUser = oConn.Execute(execstr)
>
>
>Do you know if this is possible?

Yes of course it's. I don't tend using exec but SP as I said originally:) With Exec I don't have any idea how to do.
Sample code is in VFP but easy to revise for ASP:
#include AdoConstants.h
Local cn As 'AdoDb.Connection', rs As 'AdoDb.Recordset', cmd As 'AdoDb.Command',;
  p0 As 'AdoDb.Parameter',p2 As 'AdoDb.Parameter',p3 As 'AdoDb.Parameter'
cn = Createobject('AdoDb.Connection')
cn.ConnectionString = "Provider=VFPOLEDB;Data Source=c:\temp\aitest.dbc"
cn.Open()

cmd = Createobject('AdoDb.Command')
cmd.ActiveConnection = cn
TEXT TO cCommand noshow
LPARAMETERS p1,p2
INSERT INTO myAITest (f2,f3) values (m.p1,m.p2)
RETURN myAITest.f1
ENDTEXT

cmd.CommandType=4
cmd.CommandText='ExecScript(?,?,?)'
p0 = cmd.CreateParameter("commandBody", adVarChar, adParamInput,1000)
p1 = cmd.CreateParameter("f2", adVarChar, adParamInput,20)
p2 = cmd.CreateParameter("f3", adDate, adParamInput)
cmd.Parameters.Append(p0)
cmd.Parameters.Append(p1)
cmd.Parameters.Append(p2)
p0.Value = m.cCommand
p1.Value = "InsertTest"
p2.Value = Date()
rs = cmd.Execute()
? rs.Fields(0).Value
rs.Close()
cn.Close()
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform