Showing posts with label device. Show all posts
Showing posts with label device. Show all posts

Wednesday, March 7, 2012

create mobile database from xls, csv, text or mdb

Hello,

Since my experience in VS is extremely limited, i'd like to be exused if questions sound silly.

My problem is that, at my device application project, i want to build a database that will retrieve data from .xls, or .csv, or .txt, or .mbd files. If i've noticed well, there is no support for OLEDB or ODBC, since by the time that i add tableadapter to my database.xsd and use these, after insertion i get multiple errors informing that system.data.oledb. .... or .odbc "type is not defined".

If it cannot be done, and since i still try to figure out how smart devices function, transact with databases, e.c.t. is there any suggestion?

Thank you in advance

Kostas

you'll likely need to use sql server mobile.|||

I'am trying to do so with sql mobile.

Going-> right click on "deviceapplication1" -> add -> new item -> sql mobile database

This gives me an empty database. In order to fill it i go at server explorer, right click on "AppDatabase2.sdf" (new created database), -> modify connection -> change (data source field) -> i choose microsoft ODBC data source -> user or system data source names: ms access database -> OK. Then browsing for mdb file (my access databace), and it's in server explorer; no problem yet. Then going to solution explorer, opening "AppDatabase2DataSet.xsd", drug & drop tables from server explorer to "AppDatabase2DataSet.xsd" (making table adapters(?)). Then i get this huge error list that "system.data.odbc...." Type is not defined.

Either i need to add some reference (as i did at VBA) since even autofill doesn't work (I try at the top of code to insert "imports system.data.odbc), or it's just not supported in sql mobile database

|||you can't use access as your datasource. appdatabase2.sdf IS your sql server mobile database, and that needs to remain your datasource. no odbc, no ole db in NETCF. your only mobile database option for .net development is a sql server mobile DB.|||

That is something that i have already understood after some experiment.

The question is how sql mobile works and if i can update the tables from an external (server or just a given path) sourse. I have created an sdb, with the tables required, but this tables are empty, and need to be updated each day from source files of the above mentioned format.

|||I'm not a drag and drop type of guy, but from what you've said, you're trying to create a set of adapters between Access and SQL Server Mobile -- you can't do this, there's no ODBC implementation within NETCF for the CF to talk to Access. I learned yesterday from a posting by Ilya Tumanov that there's a util called AccessSynchronizer for Access<-->SQL Server Mobile synchronization, you may want to look into it. Personally I'd just dump the stuff from Access into XML or CSV, and import using my own code, but that may not be for you. Another option is to wrap your datasource in a web service and proxy the sync operation that way.|||

Thank you Andrew, i'll take a look at accessSynchronizer. If my knowledge and experience wasn't so poor i could ask about the code for importing CSV since this is the format that interest me more, but i guess that it will be rather difficult for me fix.

Thank you very much

|||

I believe opennetcf has a csv importer, you may want to consider that ...

this post is a bit old, but may still be relevant:
http://groups.google.com/group/microsoft.public.dotnet.framework.compactframework/browse_thread/thread/671b1480a962e8e0/92d0ba873b07398d%2392d0ba873b07398d

Sunday, February 19, 2012

Create device in emulator from Management Studio

Hi,

i know i have the chance to access my mobile device (physical or emulator) from Management Studio.
I went to Connect Object Explorer, server type Sql Server Mobile but i can′t connect to my emulator and i can′t see any way to connect to a physical device either. How can i do this?

The only thing i can do is create a sql server mobile database (.sdf).

Thanks
SP

Moving to Sql Server Compact Edition forum where it has got better chance of being answered.

-Thanks,

Mohit

|||

You can do this only if your device (or emulator) is connected through active sync.

Object Explorer:

Connect->

Database file-> Select 'Browse for more' and then select 'Mobile Device' from the file browser.

If you want to create a new database on the device, then just select 'New database' instead of 'Browse'

Thanks

Pragya

Tuesday, February 14, 2012

Create Database gives Device Activation Error (5105)

Hello NG,
Creating a new database using T-SQL Create Database [MyName] used to work on
my customer's installation.
Now, it gives a Device Activation Error with error nr 5105, indicating that
MyName.mdf may be incorrect.
Nothing has changed (they claim), and I don't know why this message shows up
nor how to correct the situation.
Any help will be appreciated.
Thanks,
Hans van Leth.Hi Hans.
Can you post the full message please?
Sure - they all say "nothing's changed"!! I don't mean to question your
client's integrity, but perhaps they don't realise that a change on a non
SQL Server component might actually affect SQL Server. For example,
permissions might have changed either locally or on the AD perhaps.
If you've performed this before & it now suddenly fails, it's more than
likely that SOMETHING has changed!
Regards,
Greg Linwood
SQL Server MVP
"Hans van Leth" <hans.v.l bij xs4all.nl> wrote in message
news:evH#BqNgDHA.1760@.TK2MSFTNGP09.phx.gbl...
> Hello NG,
> Creating a new database using T-SQL Create Database [MyName] used to work
on
> my customer's installation.
> Now, it gives a Device Activation Error with error nr 5105, indicating
that
> MyName.mdf may be incorrect.
> Nothing has changed (they claim), and I don't know why this message shows
up
> nor how to correct the situation.
> Any help will be appreciated.
> Thanks,
> Hans van Leth.
>
>|||Hello Greg,
Executing "Create database test1" in QA gives:
Server: Msg 5105, Level 16, State 2, Line 1
Device activation error. The physical file name '\test1.mdf' may be
incorrect.
Server: Msg 1802, Level 16, State 1, Line 1
CREATE DATABASE failed. Some file names listed could not be created.
Check previous errors.
Creating a new database test1 in EM does work however. In Profiler I can see
that EM sends the full Create statement, i.e. including the filename as in:
CREATE DATABASE [test1] ON (NAME = N'test1_Data', FILENAME = N'C:\Program
Files\Microsoft SQL Server\MSSQL\Data\test1_Data.MDF')
The user uses an accounting package and for each company a new database is
created using the statement as mentioned.
This used to work and now it doesn't...
If I had the sources to the package I would change the Create statement to
include the filename but unfortunately it doesn't...
BOL states that including the filesnames is not required.
SQL Server default file locations are set to the ..\MSSQL\Data directory as
above.
Thanks for your time!
Hans van Leth.
"Greg Linwood" <g_linwood@.hotmail.com> schreef in bericht
news:OoB5edQgDHA.3200@.tk2msftngp13.phx.gbl...
> Hi Hans.
> Can you post the full message please?
> Sure - they all say "nothing's changed"!! I don't mean to question your
> client's integrity, but perhaps they don't realise that a change on a non
> SQL Server component might actually affect SQL Server. For example,
> permissions might have changed either locally or on the AD perhaps.
> If you've performed this before & it now suddenly fails, it's more than
> likely that SOMETHING has changed!
> Regards,
> Greg Linwood
> SQL Server MVP
> "Hans van Leth" <hans.v.l bij xs4all.nl> wrote in message
> news:evH#BqNgDHA.1760@.TK2MSFTNGP09.phx.gbl...
> > Hello NG,
> >
> > Creating a new database using T-SQL Create Database [MyName] used to
work
> on
> > my customer's installation.
> > Now, it gives a Device Activation Error with error nr 5105, indicating
> that
> > MyName.mdf may be incorrect.
> > Nothing has changed (they claim), and I don't know why this message
shows
> up
> > nor how to correct the situation.
> > Any help will be appreciated.
> >
> > Thanks,
> >
> > Hans van Leth.
> >
> >
> >
> >
>|||Do you have a way of examining the directories involved? Perhaps there's an
existing .MDF/.LDF file with the name you intend to use?
Are you trying to create the device on C:? Have you checked your server
properties (right-click server name in EM) for the default database/log
locations and verified that they are OK ("Database Settings" tab in that
"SQL Server Properties" dialog box).
I reproduced a 5105 by inserting an incorrect device letter at the beginning
of the string - I expect any malformed or incorrect filespec would give the
same result.
"Hans van Leth" <hans.v.l bij xs4all.nl> wrote in message
news:epVGfzQgDHA.632@.TK2MSFTNGP10.phx.gbl...
> Hello Greg,
> Executing "Create database test1" in QA gives:
> Server: Msg 5105, Level 16, State 2, Line 1
> Device activation error. The physical file name '\test1.mdf' may be
> incorrect.
> Server: Msg 1802, Level 16, State 1, Line 1
> CREATE DATABASE failed. Some file names listed could not be created.
> Check previous errors.
> Creating a new database test1 in EM does work however. In Profiler I can
see
> that EM sends the full Create statement, i.e. including the filename as
in:
> CREATE DATABASE [test1] ON (NAME = N'test1_Data', FILENAME = N'C:\Program
> Files\Microsoft SQL Server\MSSQL\Data\test1_Data.MDF')
> The user uses an accounting package and for each company a new database is
> created using the statement as mentioned.
> This used to work and now it doesn't...
> If I had the sources to the package I would change the Create statement to
> include the filename but unfortunately it doesn't...
> BOL states that including the filesnames is not required.
> SQL Server default file locations are set to the ..\MSSQL\Data directory
as
> above.
> Thanks for your time!
> Hans van Leth.
>
> "Greg Linwood" <g_linwood@.hotmail.com> schreef in bericht
> news:OoB5edQgDHA.3200@.tk2msftngp13.phx.gbl...
> > Hi Hans.
> >
> > Can you post the full message please?
> >
> > Sure - they all say "nothing's changed"!! I don't mean to question your
> > client's integrity, but perhaps they don't realise that a change on a
non
> > SQL Server component might actually affect SQL Server. For example,
> > permissions might have changed either locally or on the AD perhaps.
> >
> > If you've performed this before & it now suddenly fails, it's more than
> > likely that SOMETHING has changed!
> >
> > Regards,
> > Greg Linwood
> > SQL Server MVP
> >
> > "Hans van Leth" <hans.v.l bij xs4all.nl> wrote in message
> > news:evH#BqNgDHA.1760@.TK2MSFTNGP09.phx.gbl...
> > > Hello NG,
> > >
> > > Creating a new database using T-SQL Create Database [MyName] used to
> work
> > on
> > > my customer's installation.
> > > Now, it gives a Device Activation Error with error nr 5105, indicating
> > that
> > > MyName.mdf may be incorrect.
> > > Nothing has changed (they claim), and I don't know why this message
> shows
> > up
> > > nor how to correct the situation.
> > > Any help will be appreciated.
> > >
> > > Thanks,
> > >
> > > Hans van Leth.
> > >
> > >
> > >
> > >
> >
> >
>|||This is a bug. Here's what caused your error; if you go to the server
properties and specify a default location for the database\log files in
EM (Enterprise Manager), a registry entry is made on the server called
'DEFAULTDATA' & 'DEFAULTLOG' under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer.
If you ever delete the default data\log locations EM doesn't clean up
the registry correctly, it deletes the values in the keys, when if needs
to delete the keys (DEFAULTDATA & DEFAULTLOG) altogether.
So, if you delete the keys manually and restart the SQL Server
instance you'll be back in business. If you delete the keys but don't
restart the service the error is still present. Restart of the
service is required.
Posted via http://dbforums.com