Re: URGENT! Create Database Error

From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 03/31/04


Date: Wed, 31 Mar 2004 16:00:11 -0500

Ok, I gotcha. Yes, that makes sense. However, this is C# so the \ needs a
@ at the beginning or a \\ where each backslash is. Could this be the
problem.
"gfeighny" <anonymous@discussions.microsoft.com> wrote in message
news:F32BC384-72B9-4943-B6C3-72BA955B2910@microsoft.com...
> 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
>
>
>



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: Whats so special about operators, built-in classes and modules?
    ... will prevent people from modifiying string. ... Aside from the issue of C strings, I'd say the way const is used in functions is b0rken in C. Take int foo; Since bar is passed by value, any modifications of it in the body of the function are only local to the function. ... And the syntax for that is really confusing -- generally the syntax for pointers is really confusing in C as a general rule. ... As for multiple inheritance vs. single inheritance, I think the problem isn't a technical one, it's a human one. ...
    (comp.lang.ruby)
  • Re: URGENT! Create Database Error
    ... one is a file reference, and the other is the database connection string. ... big ugly assertion box, then that's not the problem, but if the assertion ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Function shortcut help
    ... Helmut, and Tony: ... Sorry for the confusing post, ... Public Function MyResult(x As String, ...
    (microsoft.public.word.vba.general)
  • Re: My fight with classes :)
    ... I got started to try a concatenation of 2 type of string, ... It was confusing to design your class in such a way that "k+'aks'" ...
    (comp.lang.python)