I need a plan of attack to copy tables from different sdf databasesinto new one.

L

Loogie

USING: VB.Net 2005 compact framework 2.0 with SQLCE Server.

I need a plan of attack to efficiently code the following scenario:

Create a new database - call it sdf1 - no problems I can do this
copy tables structure and data from sdf2 into sdf1 - no idea how to do this
copy tables structure and data from sdf3 into sdf1 - no idea how to do this

- I tried to find a copy function in the compact framework with respect
to SQLCE Server tables but to no avail.

Further how would I handle the fact that if sdf2 and sdf3 had a table of
the same name within it? It should not occur but the users may cause it
to happen and I just want to 'idiot' proof it.

Any help as to how to approach this would be appreciated. A code snippet
would be an added bonus.

Thank you

:L
 
L

Loogie

Loogie said:
USING: VB.Net 2005 compact framework 2.0 with SQLCE Server.

I need a plan of attack to efficiently code the following scenario:

Create a new database - call it sdf1 - no problems I can do this
copy tables structure and data from sdf2 into sdf1 - no idea how to do this
copy tables structure and data from sdf3 into sdf1 - no idea how to do this

- I tried to find a copy function in the compact framework with respect
to SQLCE Server tables but to no avail.

Further how would I handle the fact that if sdf2 and sdf3 had a table of
the same name within it? It should not occur but the users may cause it
to happen and I just want to 'idiot' proof it.

Any help as to how to approach this would be appreciated. A code snippet
would be an added bonus.

Thank you

:L


Here is what I have tried thus far. I am getting error as described
beside the appropriate line in the code:

'Create and open connection.
Dim ssceconn As New SqlCeConnection("Data Source = \Program
Files\data\projects\" & Me.Text & "\" & Me.Text & ".sdf")
ssceconn.Open()

Dim strIn As String
Dim strOut As String

strIn = "\Program Files\data\projects\" & Me.Text & "\" &
Me.Text & ".sdf"
strOut = "\Program Files\data\tabs\header\spec.sdf"

Dim sqlImport As New SqlCeCommand("SELECT * INTO
strIn.dbo.[tblHeader] FROM strOut.dbo.[tblHeader]", ssceconn)
sqlImport.ExecuteNonQuery() - There was an error parsing the
query. [ Token line number = 1,Token line offset = 10,Token in error =
INTO ]

' Close the connection
ssceconn.Close()
ssceconn.Dispose()
ssceconn = Nothing

engine.Dispose()
engine = Nothing
Beep()
MsgBox("import done")

:L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top