Simple task of connecting turning into nightmare

  • peter 82125

    SSCommitted

    Points: 1612

    I have a vb.net windows form project. I downloaded and installed SSCE. I created a database (sdf file) using Server Explorer in Visual Studio 2010 Pro. I was prompted to create a password for the database, so I did. Using the facilities of the GUI in VS2010, I created a dataset (xsd file in Solution Explorer) containing a TableAdapter for each table in the sdf file. But what I really need to do is run SQL queries against that database. So, I'm trying to create a connection object with a connection string for that database. I should be able to do this because the GUI did it when I created the xsd.

    This is all on a laptop not connected to any network. After I installed SSCE, a new SQL Server appeared called SQLExpress (is that what CE does??)

    I can't seem to find a way to create a connection string that doesn't blow up when it tries to run connection.open(). I've copied and pasted the connection strings from app.config. No good. I've tried this with the persist security info, without, with password, without, nothing works:

    Public cnsATMDB As String = "Data Source=Peter-XPS17\SQLEXPRESS;initial catalog=|DataDirectory|\AvilaTimeManagementDB.sdf" providerName=System.Data.SqlServerCe.3.5; Password=<password>" ';Persist Security Info=True"

    When the app runs connection.open() the error is: Invalid login for user "".

    Any help would be appreciated, thanks!

  • peter 82125

    SSCommitted

    Points: 1612

  • Ed Wagner

    SSC Guru

    Points: 286954

    I'm curious - Was it the quotes that caused the problem?

    Years ago, when I first started writing in .NET, I connected to a local SQL instance. Being completely new at it, I didn't consider permissions from the start. This caused me significant pain when I went to release to production. Looking back on it, it was a good lesson. Now, I always use an explicit SQL login and password to connect. I'm never working in an environment where I don't have to deal with least permissions.

  • peter 82125

    SSCommitted

    Points: 1612

    No, not the quotes. I was using the wrong class, it needed to be SQLCeCnnection since I'm using CE and then my connection string syntax was way off for CE.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply