Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select outputs
Message
From
24/10/2008 15:29:18
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01356977
Message ID:
01357025
Views:
17
>>>>>>When working with the OLEDB driver via NET, is it possible to SELECT into a CSV or other text file format? Seems like it only supports DBF.
>>>>>
>>>>>No (AFAIK) but you could use Stored procedure to do it.
>>>>
>>>>Great idea. Can you tell me how to execute a stored procedure in NET? I have
>>>>		Dim oConnVFP As New Data.OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("VFPLibrary").ConnectionString)
>>>>		Dim strCSV As String = "do createcsv"
>>>>		Dim objCommandCSV As New System.Data.OleDb.OleDbCommand(strCSV, oConnVFP)
>>>>
>>>>		oConnVFP.Open()
>>>>		objCommandCSV.ExecuteNonQuery()
>>>>		oConnVFP.Close()
>>>>but its not quite right.
>>>
>>>Have no idea :-)
>>>Maybe
>>>
>>>Dim strCSV As String = "createcsv()"
>>>should work.
>>>BTW are you use VFP Database or free tables?
>>
>>Dim strCSV As String = "createcsv()" && doesn't work either. I'm using a DBC.
>
>You have to set OleDbCommandType to be StoredProcedure. And then I think you just need to give a name of your sp and also set parameters separately if the SP has parameters.
>
>However, I only used it for SQL Server, but I believe it's very similar for VFP too.
Thanks Naomi. I have modified as follows:
Dim oConnVFP As New Data.OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("VFPLibrary").ConnectionString)
Dim objCommandCSV As New System.Data.OleDb.OleDbCommand("do createCSV", oConnVFP)

objCommandCSV.CommandType = Data.CommandType.StoredProcedure

oConnVFP.Open()
objCommandCSV.ExecuteNonQuery()

oConnVFP.Close()
But I am still getting an error. Here is the SP
function CreateCSV()

use c:\inetpub\wwwroot\aspxtest\app_data\library3 shared
set safety off
copy to c:\inetpub\wwwroot\aspxtest\app_data\PAGLibrary type csv
set safety on
use 
endfunc
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform