Question Connect class for SQL compact db

BenK

New member
Joined
Mar 24, 2009
Messages
2
Programming Experience
10+
Does the sqlconnection object work for a compact sql database (like Northwind for VB Express 2008)?

It seems to be from a file as opposed to a separate SQL server.
Is that a factor preventing the sqlconnection property from being able to work?
If not how can I use the sqlconnection in such a case?
Thanks!
 
SQL CE is a filebased db, it has it's own data provider with classes in System.Data.SqlServerCe namespace installed by default with VB 2008.
 
Thanks for all your replies.
Okay I tried the code below - how do I fix it to work?
Thanks.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As New SqlCeConnection
con.ConnectionString = "Data Source=C:\Documents and Settings\User\My Documents\Visual Studio 2008\Projects\Data1\Data1\Northwind.sdf"
cmd.Connection = con
cmd.CommandText = "select * from Customers"

con.Open()

dr = cmd.ExecuteReader
While dr.Read
MsgBox(dr("Country"))
End While

con.Close()


End Sub
Is there anything wrong from your view with this code (its not working for me)
 
Last edited:

Latest posts

Back
Top