Re: Problem on acces database

From: Kevin Collins \(MS - SQL Mobile\) (kevincol_at_online.microsoft.com)
Date: 09/09/04


Date: Thu, 9 Sep 2004 09:55:41 -0700

Try compacting the database by using the ISQLWCE tool that should be
installed on your device. It should be in your "PROGRAMS" folder on your
device unter the name "SQLCE Query". Attempt to connect to the database and
then an icon on the bottom will appear that will allow you to compact the
database.

Alternatively, you can compact the database from managed code or from eVB
code by using the CompactDatabase method from the engine object.

There is documentation for this on the BOL.

>From the BOL that ships with SQL Server CE v2.0.

Using SQL Server CE Query Analyzer
SQL Server CE Query Analyzer is a graphical tool included in Microsoft® SQL
ServerT 2000 Windows® CE Edition (SQL Server CE) that you can use to:

  a.. Create databases.
  b.. Manage and connect to other databases on a device.
  c.. Verify remote data access (RDA) and replication applications.
  d.. Create and modify tables and indexes in a database.
  e.. Query objects by using the SELECT statement.
  f.. Insert and delete rows in a table.
  g.. Modify existing data in a table.
  h.. Compact and repair a database.

    Note To navigate the graphical interface and execute commands in SQL
Server CE Query Analyzer on a device, you must use a stylus. However, when
the device is connected to a desktop computer, the desktop keyboard and
mouse can be used in conjunction with Microsoft Remote Display Control for
Windows CE.

Queries that are executed through SQL Server CE Query Analyzer run with the
following default behavior, which cannot be changed:

  a.. QUOTED_IDENTIFIER_ON
  b.. ANSI_NULLS_ON
  c.. ANSI_PADDING_ON
  d.. ANSI_NULL_DFLT_ON_ON
  e.. CONCAT_NULL_YIELDS_NULL_ON
Installing and Starting SQL Server CE Query Analyzer
The installation of SQL Server CE Query Analyzer depends on the development
environment onto which SQL Server CE is installed. When you install SQL
Server CE, SQL Server CE Query Analyzer is not installed by default on a
device. For more information, see Installing SQL Server CE Query Analyzer.

To start SQL Server CE Query Analyzer

  a.. Run the SQL Server CE Query Analyzer executable file, Isqlw20.exe,
directly from the Start menu or from the directory in which it is installed.
After SQL Server CE Query Analyzer is installed, you can refer to the
following topics that describe how to use it:

  a.. Navigating the Query Window
  b.. Managing Databases and Database Connections in the Objects Tab
  c.. Managing Database Objects in the Objects Tab
  d.. Executing SQL Statements in the SQL Tab
and

Using the CompactDatabase and Compact Methods
CompactDatabase and Compact are the same methods in Microsoft® SQL ServerT
2000 Windows® CE Edition (SQL Server CE), but are used in different
development environments. Use CompactDatabase in applications created with
the Microsoft eMbedded Visual Tools, and use Compact in applications created
with Microsoft Visual Studio® .NET.

These methods are essential in maintaining and changing databases. They can
be used for compacting and reclaiming wasted space. They can also be used to
change the collating order, encryption, and/or password in a SQL Server CE
database.

Because a new version of the database is created when compacting, the source
database path and destination database path must be different. In addition,
the source database must be closed and the destination database must not
exist. An error occurs if the destination database already exists or another
file with that name already exists.

If SQL Server CE is terminated when data is being written (as a result of
power failure or a full disk), the data can become corrupted.

Examples
C#

        string src = "Northwind.sdf";
        string dest = "Northwind.sdf.tmp";
      // Initialize SqlCeEngine object.
      SqlCeEngine engine = new SqlCeEngine("Data Source = " + src);

      try {
         engine.Compact("Data Source = " + dest);
         engine.Dispose();

          File.Delete(src);
          File.Move(dest, src);
      }
      catch(SqlCeException e)
      {
         //Use your own error handling routine.
         //ShowErrors(e);
      }
      finally
      {
         //Dispose of the SqlCeEngine object.
         engine.Dispose();
      }
Visual Basic .NET

    Dim src As String = "Northwind.sdf"
    Dim dest As String = "Northwind.sdf.tmp"
    ' Initialize SqlCeEngine Object.
    Dim engine As New SqlCeEngine("Data Source = " + src)

    Try
        engine.Compact(("Data Source = " + dest))
        engine.Dispose()

        File.Delete(src)
        File.Move(dest, src)

    Catch e As SqlCeException
    'Use your own error handling routine.
    'ShowErrors(e)
    Finally
        'Dispose of the SqlCeEngine object.
         engine.Dispose()
    End Try
eMbedded Visual Tools

Dim engine As SSCE.Engine
Set engine = CreateObject("SSCE.Engine.2.0")

Dim src As String
Dim dest As String

src = "Data Source=Northwind.sdf"
dest = "Data Source=Northwind.sdf.tmp"

engine.CompactDatabase src, dest
FileSystem1.FileCopy "Northwind.sdf.tmp", "Northwind.sdf"
FileSystem1.Kill "Northwind.sdf"

"Simone" <simondj@libero.it> wrote in message
news:OER1vymlEHA.3896@TK2MSFTNGP15.phx.gbl...
>> Have you tried compacting the database? Can you bring the database to
>> RAM
>> on the device and access it? Can you get to the database via ISQLCE?
>
> 1. No i not try to compact the database. But what it mean "compact" the
> database?
> 2. When open my app,i bring the database (sdf file) from the secure
> digital
> to the RAM and work on it? My Intermec 700 has about 25 megs for Storage,
> if my database is over 25 MB?
> 3. What is ISQLCE.
>
> Thanks in advance.
>
> Simon.
>
>

begin 666 note.gif
M1TE&.#EA# `+`(#_`(2&`,# P"'Y! $```$`+ `````,``L`0 (:C(\(H'S[
68%R0&ED;M7,'[%S2YW#1)VJ;4P``.P``
`
end

begin 666 coe.gif
M1TE&.#EA# `)`/<``````#,``&8``)D``,P``/\````S`#,S`&8S`)DS`,PS
M`/\S``!F`#-F`&9F`)EF`,QF`/]F``"9`#.9`&:9`)F9`,R9`/^9``#,`#/,
M`&;,`)G,`,S,`/_,``#_`#/_`&;_`)G_`,S_`/__````,S,`,V8`,YD`,\P`
M,_\`,P`S,S,S,V8S,YDS,\PS,_\S,P!F,S-F,V9F,YEF,\QF,_]F,P"9,S.9
M,V:9,YF9,\R9,_^9,P#,,S/,,V;,,YG,,\S,,__,,P#_,S/_,V;_,YG_,\S_
M,___,P``9C,`9F8`9ID`9LP`9O\`9@`S9C,S9F8S9IDS9LPS9O\S9@!F9C-F
M9F9F9IEF9LQF9O]F9@"99C.99F:99IF99LR99O^99@#,9C/,9F;,9IG,9LS,
M9O_,9@#_9C/_9F;_9IG_9LS_9O__9@``F3,`F68`F9D`F<P`F?\`F0`SF3,S
MF68SF9DSF<PSF?\SF0!FF3-FF69FF9EFF<QFF?]FF0"9F3.9F6:9F9F9F<R9
MF?^9F0#,F3/,F6;,F9G,F<S,F?_,F0#_F3/_F6;_F9G_F<S_F?__F0``S#,`
MS&8`S)D`S,P`S/\`S `SS#,SS&8SS)DSS,PSS/\SS !FS#-FS&9FS)EFS,QF
MS/]FS "9S#.9S&:9S)F9S,R9S/^9S #,S#/,S&;,S)G,S,S,S/_,S #_S#/_
MS&;_S)G_S,S_S/__S ``_S,`_V8`_YD`_\P`__\`_P`S_S,S_V8S_YDS_\PS
M__\S_P!F_S-F_V9F_YEF_\QF__]F_P"9_S.9_V:9_YF9_\R9__^9_P#,_S/,
M_V;,_YG,_\S,___,_P#__S/__V;__YG__\S______P``````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````"'Y! $``*P`+ `````,``D`0 @G`"T)'#B0E4&"
@" VRLK20X$*%# ]"G"BQXD.%%"]JC+@Q(T>,' ,"`#L`
`
end



Relevant Pages

  • Re: Administering MSDE
    ... Thanks for posting in our newsgroup and also for Costas's input. ... SQL Server Web Data Administrator ... Installing Microsoft Windows Server Update Services 3.0 on Windows Small ... Installing WSUS 3.0 won't affect the SharePoint database. ...
    (microsoft.public.windows.server.sbs)
  • Re: data connection of .net Framework & .net Compact Framework
    ... I've created an SQL Server database and I've created a smart device ... the SQL Express database directly from the mobile device. ... PC app that reads from data from Express and creates the SQL Compact ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Need Help: Operating system error 3706
    ... Installing an additional component resolved the problem and the software is now able to connect to the database ... The developer is currently doing a complete rewrite/update of the program, including database functions. ... While this would require a modest re-write, it's not that tough to convert to a managed-code provider instead of the COM-based OLE DB provider. ... If the application is not based on .NET, then make sure the application is upgraded to use the SNAC (SQL Server Native Client) provider which is less trouble-prone than the older MDAC-based providers. ...
    (microsoft.public.sqlserver.connect)
  • RE: Compacting MDB help
    ... The autoexec macro opens a ... The FrontEnd.mdb's main switchboard has a cbo to switch back end ... FECompact.mdb runs the few lines of code to compact the FrontEnd.mdb ... I'm quite certain that you can't Compact an open database from within itself ...
    (microsoft.public.access.modulesdaovba)
  • RE: Compacting MDB help
    ... This will cause the database to grow so Compacting ... not split off the tables from your FrontEnd. ... The FrontEnd.mdb's main switchboard has a cbo to switch back end ... FECompact.mdb runs the few lines of code to compact the FrontEnd.mdb ...
    (microsoft.public.access.modulesdaovba)

Loading