Results 1 to 5 of 5

Thread: (VS 2005) SQL Compact Connection

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    London United Kingdom
    Posts
    334

    Post (VS 2005) SQL Compact Connection

    I would be most grateful if anybody could help with sql server 2005 compact edition connection string and also when I use imports system.data.sqlserverce I get errors. I am new to mobile developing so I need help badly. Below is what I am trying to do but to no avail.
    Code:
    Imports System.Data
    Imports System.Data.sqlServerCe
    
    Public Class ShiftManagerDB
    
        Public Shared Function GetConnected() As SqlServerCe       
     Return New SqlServerCe(GetConnectionString)
        End Function
    
        Public Shared Function GetConnectionString() As String
            GetConnectionString = "Data source=my documents\ShiftManagerPro.sdf;persist security info=False;"
        End Function
    
    End Class
    The SqlServerCe is always underline as error.
    I am using this class in a windows app that I am coding for mobile.
    Last edited by wiadus; May 25th, 2007 at 07:57 PM.

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: (VS 2005) SQL Compact Connection

    Have you added a reference to sqlserverce?
    Try "Data Source=\My Documents\ShiftManagerPro.sdf" for your connection string

    Pete
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    London United Kingdom
    Posts
    334

    Post Re: (VS 2005) SQL Compact Connection

    Quote Originally Posted by petevick
    Have you added a reference to sqlserverce?
    Try "Data Source=\My Documents\ShiftManagerPro.sdf" for your connection string

    Pete
    Thanks Pete, but I am getting error with the imoprts system. Normaly when you type imports and hit space you get system and when click on dot you get Data and when click on dot you get sqlclient in windows but here I was expecting to get sqlserverce after Imports system.Data, so that the declaration will read Imports system.Data.SqlServerCe. Any Help

  4. #4
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: (VS 2005) SQL Compact Connection

    You will need to 1st add a reference to SqlServerCe to the project. So Right Click on reference and select Add, then pick SqlServerCe reference form the list.

    this will make it available in the imports system.data.sqlserverce
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Location
    London United Kingdom
    Posts
    334

    Post Resolve (VS 2005) SQL Compact Connection

    Quote Originally Posted by Strider
    You will need to 1st add a reference to SqlServerCe to the project. So Right Click on reference and select Add, then pick SqlServerCe reference form the list.

    this will make it available in the imports system.data.sqlserverce
    Thanks All

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width