Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / June 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Loogie - 28 Jun 2007 15:11 GMT
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
Loogie - 28 Jun 2007 16:43 GMT
> USING: VB.Net 2005 compact framework 2.0 with SQLCE Server.
>
[quoted text clipped - 17 lines]
>
> :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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.