PDA

Click to See Complete Forum and Search --> : SQl Connection Problem


wiadus
Jun 10th, 2007, 08:06 PM
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.
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

petevick
Jun 11th, 2007, 01:10 AM
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

wiadus
Jun 11th, 2007, 06:23 AM
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

petevick
Jun 11th, 2007, 06:45 AM
Hi,
where have you put the database on the emulator - you have copied it to the emulator haven't you?

Pete

wiadus
Jun 11th, 2007, 09:50 AM
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

petevick
Jun 11th, 2007, 09:58 AM
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

wiadus
Jun 12th, 2007, 07:25 AM
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.

petevick
Jun 12th, 2007, 12:13 PM
Hi,
can you not just bind it to a datasource?

Pete