Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Pass a web variable to a stored procedure
Message
From
28/10/2008 14:02:22
 
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
01257541
Message ID:
01357785
Views:
27
Ah yes. Well in any case here is my solution that works, together with an import of the CSV into an Access MDB. The initial project was to transfer data from VFP to MDB. This may not be the best solution as its my first NET project but it does work. :)
		Dim oConnVFP As New Data.OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("VFPLibrary").ConnectionString)
		
		Dim cPath As String = Server.MapPath("App_Data")
		Dim oStreamWriter As StreamWriter
		'Open the file.
		oStreamWriter = New StreamWriter(cPath + "\Temp.txt", False, Encoding.ASCII)	'Use true for append mode
		oStreamWriter.Write("keyID,envID,Shelflist,category0,category1,category2,Title,Author,Description,Region,Pubdate,Pages,Subjects,Electronic,OnLoanTo,DateAdded,AddedBy" + vbCrLf)

		Dim SQL As String = "SELECT * FROM library3 ORDER BY title "
		Using oConnVFP
			Dim command As New Data.OleDb.OleDbCommand(SQL)
			command.Connection = oConnVFP
			oConnVFP.Open()
			Dim oReader As Data.OleDb.OleDbDataReader = command.ExecuteReader()
			oReader.Read()			' Call Read before accessing data.

			Dim endquote As String = """"
			Dim midquote As String = """" + "," + """"

			While (oReader.Read())
				oStreamWriter.Write(endquote + oReader("keyID").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("envID").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("Shelflist").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("category0").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("category1").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("category2").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("title").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("author").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("description").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("region").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("pubdate").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("pages").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("subjects").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("electronic").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("onloanto").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("dateadded").ToString.Trim)
				oStreamWriter.Write(midquote + oReader("addedby").ToString.Trim)
				oStreamWriter.Write(endquote + vbCrLf)
			End While
			oReader.Close()			' Call Close when done reading.
			oConnVFP.Close()
		End Using

		'Close the file.
		oStreamWriter.Close()

		Dim oConnAccess As New System.Data.OleDb.OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings("AccessConnection").ToString)
		Dim Path As String = Server.MapPath("App_Data")
		oConnAccess.Open()
		Dim strSQL As String = ""
		strSQL = "DELETE FROM PAGLibrary"
		Dim objCommand As New System.Data.OleDb.OleDbCommand(strSQL, oConnAccess)
		objCommand.ExecuteNonQuery()

		strSQL = "INSERT INTO PAGLibrary (keyID,envID,Shelflist,category0,category1,category2,Title,Author,Description,Region,Pubdate,Pages,Subjects,Electronic,OnLoanTo,DateAdded,AddedBy)" & _
		" SELECT keyID,envID,Shelflist,category0,category1,category2,Title,Author,Description,Region,Pubdate,Pages,Subjects,Electronic,OnLoanTo,DateAdded,AddedBy FROM [Text;DATABASE=" & Path & ";].[temp.txt]"

		objCommand = New System.Data.OleDb.OleDbCommand(strSQL, oConnAccess)
		objCommand.ExecuteNonQuery()

		

		oConnAccess.Close()
>I had a recollection we discussed this before Re: Problem with VFPOLEDB driver Thread #1236245
>>Hi,
>>
>>'?' is listed as being unsupported by the VFPOLEDB provider so explains your first problem.
>>
>>However 'COPY TO' *is* at least documented as being supported so I don't know whether the seconed error message is misleading
>>(See the links from this page : http://msdn.microsoft.com/en-us/library/sht28225(VS.80).aspx for full lists of supported/unsupported commands and functions)
>>
>>If this is ASP.NET how are you ensuring (and checking) that the user is indeed you?
>>Regards,
>>Viv
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform