S
Satyaguru100
Guest
I read two foxpro tables into a dataset. I created a third table in the dataset as per my requirement. Now I want to write this table into a new foxpro table. The SQL way of doing the same is not working because it is probably searching the directory for a physical file. So how can I create a new table from an in-memory table that is existing in the DataSet? Using vb.net
Copy to DataBase
Dim sourceDir As String
sourceDir = Directory.GetParent(SourceFilePath1).ToString
sourceDir = sourceDir
Dim NewTable As String
NewTable = "Test"
connstr = "Provider=VFPOLEDB.1;Data Source="
connStr2 = connstr & sourceDir & "\"
Dim sourceTable As DataTable
myDS.Tables(3).TableName = "Out1"
sourceTable = myDS.Tables(3).Copy
NewTable = sourceDir & "\" & NewTable
Dim oConn As OleDbConnection
Dim oCmd As OleDbCommand
oConn = New OleDbConnection(connStr2)
oCmd = New OleDbCommand()
oCmd.Connection = oConn
oCmd.Connection.Open()
oCmd.CommandText = "SELECT * FROM " & sourceTable.ToString & " INTO TABLE " & NewTable
oCmd.ExecuteNonQuery()
oConn.Close()
I get the error out1.dbf file not found.
Continue reading...
Copy to DataBase
Dim sourceDir As String
sourceDir = Directory.GetParent(SourceFilePath1).ToString
sourceDir = sourceDir
Dim NewTable As String
NewTable = "Test"
connstr = "Provider=VFPOLEDB.1;Data Source="
connStr2 = connstr & sourceDir & "\"
Dim sourceTable As DataTable
myDS.Tables(3).TableName = "Out1"
sourceTable = myDS.Tables(3).Copy
NewTable = sourceDir & "\" & NewTable
Dim oConn As OleDbConnection
Dim oCmd As OleDbCommand
oConn = New OleDbConnection(connStr2)
oCmd = New OleDbCommand()
oCmd.Connection = oConn
oCmd.Connection.Open()
oCmd.CommandText = "SELECT * FROM " & sourceTable.ToString & " INTO TABLE " & NewTable
oCmd.ExecuteNonQuery()
oConn.Close()
I get the error out1.dbf file not found.
Continue reading...