-
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 07:05 AM.
Reason: Added [code]your code goes here[/code] tags
-
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 07:09 AM.
-
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.
-
Did you find a solution to this problem?
-
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
-
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
-
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.
-
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
-
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
-
By fabdulla in forum Database
Replies: 8
Last Post: 01-09-2008, 10:57 AM
-
By Brian Pittman in forum Database
Replies: 2
Last Post: 04-29-2007, 08:23 AM
-
Replies: 17
Last Post: 04-04-2003, 04:55 PM
-
By Hamad in forum VB Classic
Replies: 1
Last Post: 05-01-2001, 09:36 PM
-
By Bob Hines in forum Database
Replies: 7
Last Post: 04-27-2000, 11:14 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|