Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass a web variable to a stored procedure
Message
From
02/06/2008 11:54:33
 
 
To
30/05/2008 17:13:10
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
01257541
Message ID:
01321029
Views:
21
>><...clip>
>>
>>>
>>>Don,
>>>Viv's suggestion works. I still prefer parameters but it works:)
>>>
>>>< %
>>>    cSQLSelect = "Select * from customer where country = m.mCountry"
>>>
>>>    set oConnection = Server.CreateObject( "adodb.connection" )
>>>    with oConnection
>>>    	.ConnectionString = "Provider=VFPOLEDB;" & _
>>>        "Data source=C:\Program Files\Microsoft Visual FoxPro 9\Samples\Data\TestData.dbc"
>>>       .Errors.Clear	
>>>       .Open
>>>    end with
>>>
>>>  set oCmd = Server.Createobject("Adodb.command")
>>>  oConnection.Execute("EXEC 'public mCountry'+chr(13)+chr(10)+'mCountry=[USA]'")
>>>  with oCmd
>>>  .ActiveConnection = oConnection
>>>  .CommandText = cSQLSelect
>>>
>>>' Stored procedure with parameters
>>>'  .CommandText = "MyStoredProcedure"
>>>'  .CommandType = 4
>>>' stored procedure
>>>
>>>'  set p0 = .CreateParameter("employee", 129,1,,"MyEmployee")
>>>'  set p1 = .CreateParameter("fdate", 7, 1,,#2004/11/22#)
>>>'  set p2 = .CreateParameter("ldate", 7, 1,,#2004/11/23#)
>>>
>>>'  .Parameters.Append(p0)
>>>'  .Parameters.Append(p1)
>>>'  .Parameters.Append(p2)
>>>
>>>  set rs = .Execute()
>>>  end with
>>>
>>>    ' Check results
>>>    Response.Write("<TABLE border='1'><TR><TH>Cust ID</TH><TH>Company</TH><TH>Contact</TH><TH>Country</TH></TR>" )
>>>    while not rs.eof
>>>            Response.Write("<TR>")
>>>            Response.Write("<TD>" & rs.Fields("cust_id").value & "</TD>")
>>>            Response.Write("<TD>" & rs.Fields("company").value & "</TD>")
>>>            Response.Write("<TD>" & rs.Fields("contact").value & "</TD>")
>>>            Response.Write("<TD>" & rs.Fields("country").value & "</TD>")
>>>            Response.Write("</TR>")
>>>            rs.MoveNext
>>>    wend
>>>    Response.Write("</TABLE><BR/>")
>>>	
>>>    oConnection.Close
>>>    set oConnection = nothing
>>>% >
>>>
Cetin
>>
>>Cetin - Can you help me with a connection string that works with VFPOLEDB in .NET? I have been trying to establish a connection using
>>
>><connectionStrings>
>>        <remove name="VFPLibrary" />
>>        <add name="VFPLibrary" connectionString="Provider=VFPOLEDB.1;Data Source=|DataDirectory|library.dbc" providerName="System.Data.OleDb"/>
>>            </connectionStrings>
>>
>>which works for my Formview and Grid view pages but will not work in code. I'd sure appreciate some help with this one I've been struggling with it for 2 weeks.
>>Thanks
>
>
>"Provider=VFPOLEDB;Data Source=c:\myDataFolder\library.dbc"
>
>If it is C# then use \\ in path string or prefix the string with @.
>Cetin

Got it! Thanks
Previous
Reply
Map
View

Click here to load this message in the networking platform