Results 1 to 8 of 8

Thread: SQl Connection Problem

  1. #1

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

    Post SQl Connection Problem

    I am now writting new app and use the VB class below to connect the db but I am getting Path error. Could anyone help. I am using the emulater now not on the device.
    Code:
    Imports System.Data.SqlServerCe
    
    Public Class ShiftManagerProDB
        Public Shared Function GetConnected() As SqlCeConnection
            Return New SqlCeConnection(GetConnectionString)
        End Function
    
        Public Shared Function GetConnectionString() As String
            GetConnectionString = "Data Source= C:\My Documents\ShiftManagerPro.sdf;persist security info=False;"
        End Function
    End Class
    Moreover I generated strongly typed dataset using two tables, I am not able to drag the table onto the datagrid because the dataset shows both tables and when I drag one it shows on data from that one. Can I get help on how to go about it. thanks

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

    Re: SQl Connection Problem

    Hi,
    the device has no idea of c:\ etc - you need to put your database on the device, say in 'my documents' and open \My Documents\ShiftManagerPro.sdf

    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: SQl Connection Problem

    Quote Originally Posted by petevick
    Hi,
    the device has no idea of c:\ etc - you need to put your database on the device, say in 'my documents' and open \My Documents\ShiftManagerPro.sdf

    Pete
    Hi Pete I am still get error message that "the db could not be found check the path" the device is not connect, I am using the pc emulator, could you help me the best way of creating connection and if you could me on my second question on creating typed dataset with 2 tables. Thanks
    Last edited by wiadus; Jun 11th, 2007 at 06:31 AM.

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

    Re: SQl Connection Problem

    Hi,
    where have you put the database on the emulator - you have copied it to the emulator haven't you?

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

  5. #5

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

    Post Re: SQl Connection Problem

    Quote Originally Posted by petevick
    Hi,
    where have you put the database on the emulator - you have copied it to the emulator haven't you?

    Pete
    No pete, I am new to mobile app so I just hit deploy and set emulator. Pls help me out. Thanks

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

    Re: SQl Connection Problem

    Hi,
    have you got a device, or just the emulator? You are always better testing on the emulator if you can.

    If you add the '.sdf' file to your application, and set to 'copy to output if newer' on properties, it should copy with your app. It will copy to the same folder as your app (IIRC), so you need to open \Program Files\appname\ShiftManagerpro.sdf

    HTH

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

  7. #7

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

    Post Re: SQl Connection Problem

    Quote Originally Posted by petevick
    Hi,
    have you got a device, or just the emulator? You are always better testing on the emulator if you can.

    If you add the '.sdf' file to your application, and set to 'copy to output if newer' on properties, it should copy with your app. It will copy to the same folder as your app (IIRC), so you need to open \Program Files\appname\ShiftManagerpro.sdf

    HTH

    Pete
    Thank you very mach pete, I have got the path now but I would be grateful if you could help on this problem. I have a datagrid which I would like to display data from two tables but I am finding it difficult to use a typed dataset. Any help.

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

    Re: SQl Connection Problem

    Hi,
    can you not just bind it to a datasource?

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

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