Re: URGENT! Create Database Error

From: gfeighny (anonymous_at_discussions.microsoft.com)
Date: 03/31/04

  • Next message: Geoff Schwab [MSFT]: "Re: How to Read/Write objects to and from a file?"
    Date: Wed, 31 Mar 2004 12:41:07 -0800
    
    

    Ryan

    localDBFile = "\Program Files\PocketMTrak\MTrak.sdf";
    localDBConnection="Data Source=\Program Files\PocketMTrak\MTrak.sdf";

    are my variables. one is a file reference, and the other is the database connection string.

    Attempted the Assert, and everything looks ok, even did a hard reset, and reloaded everything.

    I am now in the process or reseting the device that this DOES work on.

         
         ----- William Ryan eMVP wrote: -----
         
         One other thing, it may already exist b/c what you are deleting isn't the
         same variable name so it might be referencing something different. Say that
         @strLocalConn = "DataSource = myFile.sdf; Password = whatever";
         
         but @strLocalDbFile is "DataSource = SomeOther.sdf; Password = whatever";
         
         You check for the existence of the second and delete it if you find it,
         however, you aren't checking for the first (unless of course you are
         positive they are the same file). Hence a
         Debug.Assert(File.Exist("@strLocalConn")) might be helpful ...if you see a
         big ugly assertion box, then that's not the problem, but if the assertion
         doesn't fail, it means strLocalConn does exist and isn't letting you create
         over it. In any case, having both is just going to be confusing and adding
         an @ at the beginning is probably confusing too since that's the prefix for
         SQL SErver parameters but these are just variables.
         You can also assert (@strLocalDbFile == @strLocalConn) ; if this succeeds
         then the strings match so the delete check you do will be valid, otherwise
         it won't be.
         Let me know if the Path in fact exists, and if the file exists, one of those
         is probably the problem.
         "gfeighny" <anonymous@discussions.microsoft.com> wrote in message
         news:A636764D-03CC-4FBB-865F-692D27D91C01@microsoft.com...
    > Keep getting error: SQL Server CE encountered problems in creating the SQL
         Server CE database. [,,,Connection string,,]
    >>>> //-- delete database file
    > if (File.Exists(@strLocalDBFile))
    > {
    > File.Delete(@strLocalDBFile);
    > }
    > //-- create local database
    > SqlCeEngine engine = new SqlCeEngine();
    > engine.LocalConnectionString = @strLocalConn;
    >> engine.CreateDatabase();
    >> Error happens on CreateDatabase Command. Oddly this code works on 1 device
         I have but not on others!
    > The local file name and database string are good, because they work on
         other devices
    >> Any ideas, I'm in a big crunch!
    >> thanks
         
         
         


  • Next message: Geoff Schwab [MSFT]: "Re: How to Read/Write objects to and from a file?"

    Relevant Pages

    • Re: Cpp Considered Harmful
      ... arraythrows an exception for you if x is out of ... In a C language, you have the option to either cross your fingers ... provide an assertion that only compiles without NDEBUG activated. ... formats the expression's value as a string. ...
      (comp.lang.cpp)
    • Re: URGENT! Create Database Error
      ... connection string. ... > big ugly assertion box, then that's not the problem, but if the ... > an @ at the beginning is probably confusing too since that's the ... > SQL SErver parameters but these are just variables. ...
      (microsoft.public.dotnet.framework.compactframework)
    • Re: The Whole Universe as a Finite Binary String?
      ... string of digits". ... So it's not the context of the reply you gave to Richard Harter ... dispute over your assertion that the past history of a string could be ...
      (talk.origins)
    • [SLE] Audacity not run
      ... When I try to start Audacity, ... : assertion `string!= NULL' failed ... : assertion `GTK_IS_WIDGET ' failed ... GDB is free software, covered by the GNU General Public License, and you are ...
      (SuSE)
    • Re: Directories Redux
      ... Another advantage is that it would do the anchoring at ... file where the string is used). ... into an absolute file reference to the first file in the library path ...
      (comp.lang.forth)