none
Microsoft.SqlServerCe.Client vs. System.Data.SqlServerCe RRS feed

  • Question

  • I want to use the connection property of the tableadapters.

    I have the following code:

        Imports System.Data.SqlServerCe

     

        Dim tbladaptBirds as TestBirdDBDataSetTableAdapters.tblBirdsTableAdapter

        Dim tbladptrVetLinks As New TestBirdDBDataSetTableAdapters.tblVetLinksTableAdapter

        Dim tbladptrVets As New TestBirdDBDataSetTableAdapters.tblVetsTableAdapter

     

        Dim con As New SqlCeConnection

     

       tbladaptBirds.Connection = con ' error here


    This gives me the following error: Value of type 'System.Data.SqlServerCe.SqlCeConnection' cannot be converted to 'Microsoft.SqlServerCe.Client.SqlCeConnection'.

    When I replaced Imports System.Data.SqlServerCe with Imports Microsoft.SqlServerCe.Client, the error went away.

    I was just playing around with a new project, and I typed in the following code

        Imports System.Data.SqlServerCe

     

        Dim con As New SqlCeConnection

        Dim tbladptr As New DatasetTestDataSetTableAdapters.tblInfoTableAdapter

     

        tbladptr.Connection = con  ' no error

    Why do I need Imports Microsoft.SqlServerCe.Client in the application I am writing while Imports System.Data.SqlServerCe is what I need in the application I was playing around with? Both programs were written on the same computer with  VS 2012

    Thanks

     

    Saturday, February 25, 2017 8:50 PM

All replies

  • Hi Ralph65,

    >>Why do I need Imports Microsoft.SqlServerCe.Client in the application I am writing while Imports System.Data.SqlServerCe is what I need in the application I was playing around with?

    Based on your description and related error message, it seems that 'Imports System.Data.SqlServerCe' and 'Microsoft.SqlServerCe.Client.SqlCeConnection'  have the same name method, which are conflict. please define your variable named con like this:

    Dim con As New System.Data.SqlServerCe.SqlCeConnection

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 28, 2017 5:40 AM
    Moderator
  • Hi, Cole Wu,

    There is no conflict between  System.Data.SqlServerCe and Microsoft.SqlServerCe.Client because In the application I am writing, I had only System.Data.SqlServerCe. Upon getting the error message, I changed it to Microsoft.SqlServerCe.Client, and it worked. I never had both Microsoft.SqlServerCe.Client and System.Data.SqlServerCe in the same application.

    In the application I was playing around with, I had System.Data.SqlServerCe, and did not get the error.

    Thanks,

    Ralph65

    Tuesday, February 28, 2017 10:19 PM