data transfer from sql server table into dbf table programically--

Posted on 2006-06-05
Last Modified: 2007-12-19
I need to transfer the data from sql server database table called sales into a dbf table call reference.dbf.

my sql server table got 3 filelds    SerialNo          nvarchar(200)
                                                 UploadedTime   Date/ Time                      ---Using Today()

My dbf got only one field          SerialNo

I need to move the SerialNo field data into the dbf SerialNo field.

My Sql sever table field "SerialNo" got  1million records and i need to move everything into the dbf "SerialNo" column

Here is the connection String i am usinn in one of my program..

sql ---

Dim SQLCon As SqlConnection = New SqlConnection("Server=ServerIP;User id=sa;pwd=sample;Database=sales")

Dim oODBCConnection As OdbcConnection
Dim sConnString As String = "Driver={Microsoft Visual FoxPro Driver};SourceDB=\\salesdatabase\abc;SourceType=DBF;"

Pls provide me a program to achieve the above task/
Question by:nyee84
    1 Comment
    LVL 7

    Accepted Solution

    have you tried exporting the sql serialNo field into XML or CSV or even into an excel spreadsheet?

    if you can do that
    you should be able to import those file types into FoxPro

    if not what you can do is write a program that will connect to your sql db, read from it, save it as a dataset
    then with your dataset insert it into a foxpro table

    just something off the top of my head right now

    the MySQLCommand and MySqlDataAdapter are mysql types, just sub those for SQL types

    public function returnSQLStuff() as dataset

            Me.myQueryString = "SELECT SerialNo from Sales'"

            myCommand = New MySqlCommand(myQueryString, myConnection)
            myDataAdapter = New MySqlDataAdapter()
            myDataAdapter.SelectCommand = myCommand

            ds = New DataSet
            myDataAdapter.Fill(ds, "orders")

            Return ds

    end function

    myConnection isyour foxpro connectionstring

    public function insertIntoFoxPro(serial as string) as boolean
     myQueryString = "INSERT INTO reference values ('" & serial & "')"

            myCommand = New MySqlCommand(myQueryString, myConnection)

    end function

    in your program call the SQL function
    dim dSet as dataset
    dim pRow as datarow

    'populate the dataset with the SQL information
    dSet = returnSQLStuff()

    'now we iterate through each item in teh dataset and insert the value into foxpro
    for each pRow in dSet.Tables("sales").rows



    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now