Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2006-06-05
1
Medium Priority
?
305 Views
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")

foxpro
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/
 
0
Comment
Question by:nyee84
1 Comment
 
LVL 7

Accepted Solution

by:
foobarr earned 2000 total points
ID: 16842342
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)

           myCommand.executeQuery()
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
         insertIntoFoxPro(pRow("SerialNo").ToString())
next


cheers



0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Screencast - Getting to Know the Pipeline
Suggested Courses

578 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