sqlCE & sqlClient.. is this possible?
connection1 is in sqlCE.. -- db1.sdf
connection2 is in sqlClient.. -- db1.mdf
connection2 will load data from table1 of db1.mdf,
then after loading, display the data in a grid control or listview control,
by pressing a command button all data in the grid/listview control will be added to table1 of db1.sdf using connection1.
is this possible?
________
Iolite Vaporizer
Re: sqlCE & sqlClient.. is this possible?
Absolutely. A DataTable doesn't know or care anything about where the data it contains came from or goes to. The gotcha is that, when you call Fill on a DataAdapter to populate a DataTable, the table's AcceptChanges method is called after the data is added by default. This will set the RowState of each DataRow to Unchanged, meaning they can't be saved anywhere. What you need to do is set the filling DataAdapter's AcceptChangesDuringFill property to False. That way AcceptChanges will not be called and all the RowStates will remain as Added, meaning they are considered new rows ready to be inserted.
Re: sqlCE & sqlClient.. is this possible?
i had tried this but it does not work. can you give me examples?
________
Digital Scales
Re: sqlCE & sqlClient.. is this possible?
How about you show us what you tried and then we can help you tweak that? Also, please explain what "it does not work" means. What happens that shouldn't? What doesn't happen that should?
Re: sqlCE & sqlClient.. is this possible?
OMG! i already deleted the project. ill try to create a new one and post it.. thanks
________
Vaporgenie reviews
Re: sqlCE & sqlClient.. is this possible?
i cant establish connection on the .sdf files..
code:
vb Code:
Imports System.Data
Imports System.Data.SqlServerCe
Public Class Form1
Public cn As New SqlCeConnection
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cn.ConnectionString = "Data Source=\Program Files\MPOS\DATAs\dbMPOS.sdf;"
If cn.State = 1 Then cn.Close()
cn.Open()
MsgBox("Connection Ok")
End Sub
End Class
error:
cn.open ---->The path is not valid. Check the directory for the database. [ Path = \Program Files\MPOS\DATAs\dbMPOS.sdf ]
SqlCeException was unhandled
im sure that my database path is correct
________
Los angeles dispensaries
Re: sqlCE & sqlClient.. is this possible?
I don't develop for mobile devices so I don't know how file paths work on Windows Mobile. That said, I'm guessing that your SDF file is in the same folder as your EXE. In that case you shouldn't have to specify a path, just a file name.
Re: sqlCE & sqlClient.. is this possible?
Hi,
check your path is valid.
If you didn't create it yourself, and your app is MPOS the path would be by default
\program Files\Mpos\dbmpos.sdf
Re: sqlCE & sqlClient.. is this possible?
i already created it.. by the way im using windows application form. does it has something to do with the error?
________
Italian recipes
Re: sqlCE & sqlClient.. is this possible?
Quote:
Originally Posted by
rothj0hn
i already created it.. by the way im using windows application form. does it has something to do with the error?
You mean you are using a desktop application, not a device application?
Re: sqlCE & sqlClient.. is this possible?
it goes like this i have a window application connected to db1.mdf and a device application connected to db1.sdf.. what i want to do now is connect my window application to the db1.sdf of my device..
________
Plymouth pronto spyder specifications
Re: sqlCE & sqlClient.. is this possible?
Quote:
Originally Posted by
rothj0hn
it goes like this i have a window application connected to db1.mdf and a device application connected to db1.sdf.. what i want to do now is connect my window application to the db1.sdf of my device..
In future, please provide a FULL and CLEAR description of the problem in the first post. If we only have half the relevant information it makes it rather hard to provide a relevant solution.
Re: sqlCE & sqlClient.. is this possible?
sorry about that..
________
Silver Surfer Vaporizer
Re: sqlCE & sqlClient.. is this possible?
So this code is being executed on a desktop machine to access an SDF file on a mobile device, correct? In that case it can't work like that because there's nothing in your connection string to indicate that the database is on the device. The path you're specifying will be interpreted as relative to the folder containing the current EXE. You need to specify the same path you would need to use to access the file in Windows Explorer. If the device is connected to the network then that would presumably require either a UNC path or a mapped network drive. If the device is connected directly to the desktop machine then I don't know but I'd guess that the device would appear as a drive. Regardless, simply navigate to the SDF file in Windows Explorer and you've got your path.
Re: sqlCE & sqlClient.. is this possible?
Hi,
OK - you can't do that directly, open a database on the device from a windows forms application.
You can open a database on the device, and a database on the desktop (using the network), but you can't open a database on the device without using a 3rd party tool, or writing your own 'plumbing'.
The exception would be if your PPC could act as a USB drive which SOME devices can. In that case you would treat it as another disk drive.
HTH
Re: sqlCE & sqlClient.. is this possible?
PPC that im using now doesnt act as a disk drive. i simply open its content on the explore of the active sync. and the usual path that i get is just program files/foldername/filename..
no drives.
what is plumbing anyway?
________
Mercury Turnpike Cruiser Picture
Re: sqlCE & sqlClient.. is this possible?
Plumbing: writing your own routines to access the database on the device and pass it across the network
Re: sqlCE & sqlClient.. is this possible?
Quote:
Originally Posted by
rothj0hn
PPC that im using now doesnt act as a disk drive. i simply open its content on the explore of the active sync. and the usual path that i get is just program files/foldername/filename..
no drives.
Think about it. Would you really expect that path to lead to the database file on the device from the desktop? How would your desktop app know that the path was on an attached device?
Re: sqlCE & sqlClient.. is this possible?
thats what im trying to find out..
________
Toyota rav4 ev history
Re: sqlCE & sqlClient.. is this possible?
Just messing in Explorer in Vista - I can actually navigate to a path using
Computer\Petes_Serra\\\My Documents\ - Petes_Serra being the name of my phone.
Having said that, I doubt if it would work using SqlServer to address it, and it looks to be Vista specific.
I really think you are down to using a 3rd party solution, or attempting to write your own.
You could always do it the other way round - access your desktop database, and device database from your device