Specified table does not Exist.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: Specified table does not Exist.

  1. #1
    Join Date
    Nov 2011
    Location
    Netherlands
    Posts
    4

    Specified table does not Exist.

    Hi,
    I am fairly new to programming and I am using Visual Studio Express 2010

    I am trying to export a delimited file CSV or TXT into a SDF database.
    But I get every time the next error:

    The specified table does not exist. [ Text;C:\Users\Me\Documents\Visual Studio\Projects\CSV-Text-SDF\Oregon.text]

    Searched the internet for a solution but to no avail.

    The code I am using is mentioned below.
    Code:
    Imports System.IO
    Imports System.Data.SqlServerCe
    Imports System.Data
    Imports System.Data.SqlClient
    
    
    Public Class Form1
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    
            Dim Path As String = "C:\Users\H.G. van Andel\Documents\Visual Studio 2010\Projects\CSV-Text-SDF\"
           
            Dim connect As String
    
            connect = "Data source =" & Path & "Waypoints.sdf"
            Dim conn As New SqlCeConnection(connect)
    
            Dim Query As String = "Insert INTO POI (Lat,Lon,Icon,[desc],Stad,Categorie,land,Staat) Select Lat,Lon,Icon,[desc],Stad,Categorie,land,Staat From [Text;" + Path + "Oregon.txt]"
           
            Dim cmd As SqlCeCommand = New SqlCeCommand(Query, conn)
            conn.Open()
            Try
                'Catch ex As SqlCeException
                cmd.ExecuteNonQuery()
            Catch ex As SqlCeException
                MessageBox.Show(ex.Message)
    
                conn.Close()
              
            End Try
        End Sub
    End Class
    Is there somebody who can help me and telling me what I am doing wrong.

    Or is there a better way to do this?
    Map_Freak
    Last edited by Hack; 11-14-2011 at 08:05 AM. Reason: Added [code]your code goes here[/code] tags

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    The VB Classic section is for questions on Visual Basic 6 and earlier versions, where as the .NET section is for questions pertaining to all versions of VB.NET. Therefore, I have moved your thread over to .NET (and added [code]your code goes in here[/code] tags to make reading the posted code a bit easier.)
    Last edited by Hack; 11-14-2011 at 08:09 AM.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Nov 2011
    Location
    Netherlands
    Posts
    4

    Unhappy Closing this thread.

    Hi,

    Nobody made a replay to solve this problem.
    I like to close this thread and if possible to remove this thread completly from this forum.

    Map_Freak.

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Did you find a solution to this problem?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #5
    Join Date
    Nov 2011
    Location
    Netherlands
    Posts
    4
    Hello Hack,

    I didn't found a solution on this error.
    But a developer gave me a workable solution to load a "cvs" into a SQLCE "sdf" database.
    If there is a need for, you can found the code on this url http://www.vbcentral.nl/Forums/tabid...4/Default.aspx

    Map_Freak

  6. #6
    Join Date
    Nov 2011
    Location
    Netherlands
    Posts
    4
    Sorry Guys,

    This site is a Dutch spoken site.

    If there is a need I will Copy the code on this forum.

    On one of the last quotes is an a 001_windowsapplication.zip

    Map_Freak

  7. #7
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    I don't think you need to copy anything....if anyone is interested they can always copy and paste the Dutch code comments into Google Translator.

    Thanks for posting the link.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  8. #8
    Join Date
    Oct 2008
    Posts
    142

    bulk insert

    hi there,

    i have never worked with sql server ce.
    however, what one might know about standard sql server might apply to sdf databases.
    look at your returned error:

    The specified table does not exist. [ Text;C:\Users\Me\Documents\Visual Studio\Projects\CSV-Text-SDF\Oregon.text]

    it is because you made an insert into from table that is specified as path ending in a text file name.
    that table really doesn't exist, so this error message is clear.
    your task is really importing a text file into a sdf table.
    if it was regular tsql (which it might easily be this case) can be accomplished in two or more ways.
    look at this page:

    http://technet.microsoft.com/en-us/l...5(SQL.90).aspx

    and now look at this tsql code snippet:

    Code:
    BULK INSERT AdventureWorks.Sales.SalesOrderDetail
       FROM '\\computer2\salesforce\dailyorders\neworders.txt';
    well, bulk insert can do this task you need.
    it is like

    Code:
    BULK INSERT <target_table>
       FROM <path_to_your_text_file>
    i know bulk insert works because i have used it.
    i also know bcp utility works because i have used it too.
    i don't know if ssis (dts) can be used in a sdf db.
    maybe, there is no bcp utility for sdf dbs as well.
    you could also try openrowset, but i haven't used this sql statement.

    good luck,

    tonci korsano

  9. #9
    Join Date
    Nov 2011
    Location
    Netherlands
    Posts
    4
    Thanks tonci korsano,

    For now my app works.
    The next time I use a database I will come back to this thread and will try the bulkcopy option and than with a SQL database.
    Thanks again for your reply.

    Map_freak

Similar Threads

  1. how to insert into a table where not exist?
    By fabdulla in forum Database
    Replies: 8
    Last Post: 01-09-2008, 11:57 AM
  2. Database Design Help needed
    By Brian Pittman in forum Database
    Replies: 2
    Last Post: 04-29-2007, 09:23 AM
  3. How would u do it (design question) ?
    By Joe in forum Database
    Replies: 17
    Last Post: 04-04-2003, 05:55 PM
  4. Table Is Exist ??
    By Hamad in forum VB Classic
    Replies: 1
    Last Post: 05-01-2001, 10:36 PM
  5. Multi-row calculations
    By Bob Hines in forum Database
    Replies: 7
    Last Post: 04-27-2000, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center