Saturday, May 26, 2007

You are trying to access an older version of a SQL Server Compact Edition database. If this is a SQL Server CE 1.0 or 2.0 database, run upgrade.exe.

This happens when your .sdf database version changed and perhaps corrupted. It might due to merge replication of using SQL Server 2005. Therefore the only solution is to repair it.

To repair it you must use the
System.Data.SqlServerCe.SqlCeEngine class, version 9.0.242.0 or 3.5.0.0

Here is the example of the implementation.


File.Copy(@"F:\northwind.sdf",@"F:\northwind.sdf.temp");
File.Delete(@"F:\northwind.sdf");
SqlCeEngine
engine = new SqlCeEngine(@"Data Source
=F:northwind.sdf.temp");
engine.Compact(@"Data
Source=F:\northwind.sdf");
File.Delete(@"F:\northwind.sdf.temp");



A repaired northwind.sdf is produced and now you should not be getting this error again. Any other alternative? Please let me know. :)

50 comments:

Anonymous said...

Thanks a LOT..really a chicky way out....CLEVER PIECE OF CODE.

Anonymous said...

Thanks a lot. It solved my problem.

Anonymous said...

What if the database you're trying to convert is password protected?

PHT said...

code runs after modifying:

SqlCeEngine engine = new SqlCeEngine (@"Data Source="...")

The string must start with "Data Source="

Anonymous said...

I tried it and it throws an exception that the password specified is not correct... and I did not set a password...
any ideas

Anonymous said...

Where to run this code. Should I write a console aplliaction?

Unknown said...

Hello
i tried to do what u are recomending.
(im using vb.net but its basicly the same idea)
Private Function check_login(usr As String, pws As String) As Integer
Dim results As Integer = 0
Try
Dim command, path As String
path = "C:\Users\CK\Desktop\WebSite1\App_Data\Personeel.sdf"
command = "" & _
"Create PROCEDURE procLogin" & _
"@Username VarChar(50)," & _
"@UPassword varChar(50)," & _
"@OutRes int OUTPUT" & _
"set @Username =(" & usr & ")" & _
"set @UPassword=(" & pws & ")" & _
"AS" & _
"set @OutRes = (SELECT count(*) FROM [Personeel].[tblUser] WHERE Username = @Username And [Password] = @UPassword)" & _
"if(@OutRes = 1)" & _
"begin()" & _
"Logged_in = 1" & _
"set @OutRes = 1--Login is Correct2" & _
"End" & _
"Else" & _
"begin()" & _
"Logged_in = 0" & _
"set @OutRes = 0 --Bad login" & _
"End"
FileCopy(path, path & ".temp")
FileCopy(path, "C:\Users\CK\Desktop\WebSite1\App_Data\Personeel2.sdf")
System.IO.File.Delete(path)
Dim engine As New SqlCeEngine("Data Source = '" & path & ".temp'; File Mode = 'shared read'; Password= 'ibgoesit';")
engine.Compact("Data Source = '" & path & "'; File Mode = 'shared read'; Password= 'ibgoesit';")
System.IO.File.Delete(path & ".temp")
Dim conn As SqlCeConnection = Nothing
Try

conn = New SqlCeConnection("Data Source = '" & path & "'; File Mode = 'shared read'; Password= 'ibgoesit';")
conn.Open()
Dim cmd As SqlCeCommand = conn.CreateCommand()
cmd.CommandText = command
cmd.Parameters("@OutRes").Direction = Data.ParameterDirection.Output
cmd.Connection = conn
cmd.ExecuteNonQuery()
results = cmd.Parameters("@OutRes").Value
cmd.Dispose()
System.Console.WriteLine("Result: " & results)
Catch ex As Exception
ErrorBoard.Text = ex.ToString
results = 2
Finally
If (Not conn Is Nothing) Then
conn.Close()
End If
End Try
Catch ex As Exception
ErrorBoard.Text = ex.ToString
results = 2
End Try
Return results
End Function
Now it says: "The specified password does not match the database password." when i run it.
U know why it does?
Cheers Anton

Anonymous said...

Thank you a lot for sharing this with all folks you actually understand what
you're speaking approximately! Bookmarked. Kindly also discuss with my site =). We will have a link exchange agreement among us

Here is my web blog; the story behind aunt jemima

Anonymous said...

Hi there! I just want to give you a huge thumbs up for the
excellent information you've got here on this post. I will be returning to your website for more soon.

Take a look at my webpage stouffer's harvest coupons

Anonymous said...

I have read so many content about the blogger lovers however this article is actually a pleasant post,
keep it up.

Look at my blog - kleenex cool touch tissue coupons

Anonymous said...

My family members always say that I am killing my time here
at web, except I know I am getting experience all the
time by reading thes pleasant articles.

Here is my web page :: digiorno 200 calorie pizza Coupons

Anonymous said...

When someone writes an piece of writing he/she keeps the idea of a user in
his/her brain that how a user can understand it. Therefore that's why this paragraph is perfect. Thanks!

My site: Alcoholic Drinks With powerade

Anonymous said...

Pretty! This has been an incredibly wonderful post. Many
thanks for supplying this info.

my web-site - aunt jemima waffles printable coupons

Anonymous said...

Great site you have here.. It's difficult to find quality writing like yours these days. I honestly appreciate individuals like you! Take care!!

my page; nutritional content of powerade

Anonymous said...

Great blog right here! Additionally your site rather a lot up fast!
What web host are you using? Can I am getting your associate hyperlink for your host?
I desire my site loaded up as fast as yours
lol

Here is my blog post: extreme couponing charmin

Anonymous said...

I don't know whether it's just me or if perhaps everybody else experiencing problems with your blog.
It appears as if some of the written text on
your posts are running off the screen. Can someone else
please provide feedback and let me know if this is happening to
them too? This could be a problem with my browser because I've had this happen before. Thanks

My homepage - mr suave lyrics

Anonymous said...

Hi! I simply would like to give you a big thumbs up for your great
info you've got here on this post. I'll be coming
back to your website for more soon.

My page jamie oliver rabbit ragu

Anonymous said...

Someone essentially assist to make severely posts
I might state. That is the first time I frequented your website page and
to this point? I amazed with the research you made to create this particular publish amazing.
Magnificent process!

Take a look at my webpage ... always kotex pads

Anonymous said...

What a information of un-ambiguity and preserveness of precious knowledge concerning
unpredicted emotions.

Also visit my homepage :: coupons for free gatorade

Anonymous said...

I am curious to find out what blog system you are utilizing?
I'm experiencing some minor security issues with my latest site and I would like to find something more safe. Do you have any suggestions?

Here is my page ... rio turkey hunts

Anonymous said...

I was able to find good information from your blog posts.


Also visit my web-site ... amount of caffeine in maxwell house coffee

Anonymous said...

I'm truly enjoying the design and layout of your website. It's a very easy on the eyes which
makes it much more enjoyable for me to come here
and visit more often. Did you hire out a developer to create your theme?
Exceptional work!

my web page John Shea Gatorade

Anonymous said...

Very soon this site will be famous among all blog people, due to it's pleasant articles or reviews

Feel free to visit my web blog: purina dog food coupons

Anonymous said...

It is appropriate time to make a few plans for the longer term
and it's time to be happy. I've learn this
submit and if I may just I desire to suggest you some
fascinating things or tips. Perhaps you can write subsequent articles regarding this article.
I wish to read more things about it!

Feel free to surf to my site does nicorette gum work

Anonymous said...

I'm truly enjoying the design and layout of your blog. It's a
very easy on the eyes which makes it much more pleasant for me to come here and visit more often.
Did you hire out a designer to create your theme? Exceptional work!


Also visit my site philadelphia cream cheese coupons november 2011

Anonymous said...

What i do not understood is in fact how you are now not
actually much more well-appreciated than you might be right now.

You are so intelligent. You recognize therefore significantly in the case of this topic,
made me personally consider it from a lot of
varied angles. Its like women and men aren't fascinated except it's one thing
to do with Lady gaga! Your own stuffs outstanding.
All the time maintain it up!

My web blog; The Lonesome Dove

Anonymous said...

Your means of explaining everything in this piece of writing is truly
nice, every one can without difficulty be aware of it, Thanks a lot.


Review my webpage - grocery coupons bertolli

Anonymous said...

You should take part in a contest for one of the finest blogs on the internet.
I'm going to recommend this website!

My web-site - are lipton tea bags good for you

Anonymous said...

hey there and thank you for your information – I've definitely picked up something new from right here. I did however expertise a few technical issues using this site, as I experienced to reload the site many times previous to I could get it to load correctly. I had been wondering if your web host is OK? Not that I am complaining, but slow loading instances times will often affect your placement in google and can damage your high quality score if ads and marketing with Adwords. Anyway I'm adding this RSS
to my email and can look out for much more of your respective exciting content.
Make sure you update this again very soon.

My webpage walmart crystal light

Anonymous said...

Right here is the perfect webpage for anybody who really wants to understand this topic.
You realize so much its almost hard to argue with you (not that I
really will need to…HaHa). You definitely put a fresh spin on a subject that has been
written about for years. Great stuff, just great!

Also visit my website :: Mint Chocolate Chip Chobani

Anonymous said...

Howdy! I realize this is kind of off-topic however I had to ask.
Does building a well-established blog such as yours take a lot
of work? I'm completely new to blogging however I do write in my diary everyday. I'd like to start a blog
so I can easily share my personal experience and feelings online.
Please let me know if you have any kind of recommendations
or tips for brand new aspiring blog owners. Appreciate it!


Have a look at my page - kraft Fresh take cheese and breadcrumb mix coupons

Anonymous said...

If you desire to get a great deal from this article then you have to apply such methods
to your won website.

Also visit my web site ... coupons for schick hydro silk razor

Anonymous said...

Hey there just wanted to give you a quick heads up. The text in your post seem to be running off the screen in Internet explorer.
I'm not sure if this is a format issue or something to do with web browser compatibility but I figured I'd post to let you know.

The style and design look great though! Hope you get the issue
resolved soon. Thanks

Here is my homepage :: http://girlswithblank.com/KazukoLMX

Anonymous said...

Spot on with this write-up, I really believe this web site
needs a great deal more attention. I'll probably be returning to read more, thanks for the advice!

Feel free to visit my web blog ... coupons for hormel bacon

Anonymous said...

Hello there! I could have sworn I've visited this site before but after going through some of the articles I realized it's new to me.
Anyhow, I'm definitely pleased I stumbled upon it and I'll be bookmarking it and checking back
often!

Here is my blog post: Healthy Choice Dinner Coupons

Anonymous said...

If you are going for finest contents like I do,
just pay a quick visit this web page all the
time for the reason that it presents quality contents, thanks

Feel free to visit my homepage http://www.linkiamo.com

Anonymous said...

Having read this I thought it was really enlightening. I
appreciate you taking the time and energy to put this informative article together.
I once again find myself spending a lot of time both reading and leaving comments.
But so what, it was still worth it!

my webpage :: eukanuba in store coupons

Anonymous said...

If some one wishes to be updated with most up-to-date technologies therefore he must be visit
this site and be up to date everyday.

my blog: barilla whole grain pasta printable coupons

Anonymous said...

Thank you for the good writeup. It in fact was a amusement account it.
Look advanced to more added agreeable from you!
By the way, how can we communicate?

Also visit my web blog kleenex paper towels coupons

Anonymous said...

Thanks very nice blog!

my blog post: charmin freshmates coupons

Anonymous said...

I'm amazed, I must say. Seldom do I encounter a blog that's both educative and entertaining,
and without a doubt, you've hit the nail on the head. The problem is an issue that not enough folks are speaking intelligently about. Now i'm very
happy that I came across this in my hunt for something regarding this.



Feel free to visit my blog Target Digiorno Pizza Coupons

Anonymous said...

Hi superb blog! Does running a blog similar to this take a lot
of work? I have no expertise in coding but I was hoping to
start my own blog soon. Anyhow, should you have any ideas or techniques for new blog owners please share.
I understand this is off topic however I simply had to ask.
Kudos!

Here is my blog post Tag Heuer Formula 1 Watches

Anonymous said...

Have you ever looked within the mirror and questioned what
was missing? Your clothes are fashionable,
your selected socks really match, and you are sporting freshly
polished footwear, but something is off. The answer is probably tag heuer aquaracer calibre 5.

Even a easy piece of tag heuer aquaracer grande date can unite your outfit with each other.


Also visit my blog tag heuer aquaracer automatic

Anonymous said...

I conѕtantly emailed this blog post page to all my contaсts,
since if like to read it afterward my contactѕ
ωill tοο.

Fеel free tо visit my homepage - unlock Iphone 4

Anonymous said...

I еnјoy reading through аn аrticle thаt сan maκе peoplе think.
Also, thаnks fοr allowing for me to cοmmеnt!


my blog post; samsung galaxy s 3 unlock

Anonymous said...

There are many details that need to be addressed when making an auto
purchase. If you are unaware of these details, you could find yourself overpaying for the car
that is not right for you. You will find some great advice in the article that follows that
will assist you in purchasing your next car.


Review my homepage cars

Anonymous said...

Memory loss or cognitіve decline is actually a really frequent and problematiс аmongst thе elderly.
This cаn be verу hard on both for
the affectеԁ individuаl too as their loved ones.
Lіsted here aгe some useful ѕuggestіons for dealing
wіth the mеmory lοsѕ that's happening around you.

My web blog :: procera avh

Anonymous said...

I don't even understand how I ended up right here, but I thought this post used to be great. I do not realize who you are however definitely you're going to
а well-knoωn blοgger if you аren't already. Cheers!

My web site ... phlebotomy classes chicago

Anonymous said...

Do you wish tο know how to usе gain ԁish ԁetergent cοupon?

Utilizing gain cοupοns effіcientlу can help yοu savе a lot of yоur price rangе.
Study the following aгtіcle
to finԁ gοod іԁeas that maу aid you use gaіn рrіntable
couponѕ and save probably the most cash achiеvable.


my website ... http://extremecouponingonline.net

yanmaneee said...

curry 6 shoes
curry 7
golden goose sneakers
golden goose sneakers
jordan 13
longchamps
jordan retro
moncler outlet
off white nike
kyrie 6 shoes