Solved

How to create XML File and then send it by FTP ?

Posted on 2011-09-10
13
397 Views
Last Modified: 2012-05-12
HI

I am new with windows forms apps and vb.net, I would like to know how to create an application that could read a FoxPro database, create an XML file with the query and finally send it through FTP to a website.

Thanks in advance.

0
Comment
Question by:dimensionav
  • 8
  • 4
13 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 36517168
0
 

Author Comment

by:dimensionav
ID: 36519515
I have noticed that the connection string for FOX Pro databases looks for a DBC file but I have DBF Files
0
 

Author Comment

by:dimensionav
ID: 36519523
Sorry I have misunderstood the file types that I have to read, I think these are xbase files but not FOX Pro.... am I right?
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 500 total points
ID: 36519588
I have noticed that the connection string for FOX Pro databases looks for a DBC file but I have DBF Files
I can't say that I know what the difference is. However, if you're not sure which connection string to use you can always check here:

    http://www.connectionstrings.com/visual-foxpro

This one:

    http://www.connectionstrings.com/visual-foxpro#p2cs1 (Free Table directory)

appears to deal in DBF, but I'm not really a FoxPro guy so I can't confirm.

0
 

Author Comment

by:dimensionav
ID: 36519614
The fact of using as a datasource path this: SourceDB =c:\myvfpdbfolder, makes me think that I can perform queries over all the tables (DBF Files) in that directory, right?
0
 

Author Comment

by:dimensionav
ID: 36519892
I have tried a couple of connection strings but I got the following errors:

 sConn = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB=c:\mydbf;"
Driver does not support this function

sConn = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\mydbf;"
DBF External table is not in the expected format
0
 
LVL 41

Expert Comment

by:graye
ID: 36519942
Just curious... are you working from a 64-bit PC?
0
 

Author Comment

by:dimensionav
ID: 36520069
I am using windows server 2003 32Bits, but seems that the problem was the version of the ODBC driver..
I have downloaded and installed this: http://msdn.microsoft.com/en-us/vfoxpro/bb190233 and now the query is working pretty well.

Now... I will continue with the rest of the project.
0
 

Author Comment

by:dimensionav
ID: 36520181
kaufmed:

I order to understand better your solution, why I have to use a datareader and then load it into a dataset?, is this because of performance of a datareader vs. datatable?
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36523015
I mentioned DataReader because you can call DataSet.Load and pass an instantiated DataReader to have the DataSet populated with little effort on your part. DataSet has the GetXml method which will return you the XML version of your DataSet.

Please don't think that this is the only way to achieve what you are after. I felt as though it would be the simplest, but there could be an even simpler method.
0
 

Author Comment

by:dimensionav
ID: 36523295
kaufmed:

Actually is a good way is just that I am doing another process that brings a table so, I decided to use it but I just wanted to know if a datareader is better in performance than a table.

At this point I can create the XML File, and I have a question:

The structure is like the code attached, this file will be read in a website, I wonder if I need to create the first line like <?xml version="1.0" encoding="utf-8" ?> and stuff like that, related to XML standards or the file is perfect for what I need? (I´m not experienced in XML)

Thanks!

<PRODUCTS>
   <PRODUCT>
     <FIELD1>Value 1</FIELD1>
     <FIELD2>Value 2</FIELD2>
   </PRODUCT>
</PRODUCTS>

Open in new window

0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36524501
You don't have to have an XML declaration in an XML file (the <?xml ... ?> part), but it usually doesn't hurt. If you are unsure, I'd say try it out without the declaration and see if it works; if it doesn't, then you'll most likely have to add it. I can't recall running into a situation where my code failed due to a missing declaration.
0
 

Author Closing Comment

by:dimensionav
ID: 36525523
Thank you very much, my demo app is now running.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Database Connections Not being returned to Connection Pool 7 34
vb.net 1 month apart 11 35
"Emulate" TAB key when press Enter Key 3 48
Passing data between Forms 3 20
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question