{"id":5621,"date":"2014-04-04T05:10:41","date_gmt":"2014-04-04T05:10:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/04\/cant-use-sql-serverce-in-visual-studio-project-collection-of-common-programming-errors\/"},"modified":"2014-04-04T05:10:41","modified_gmt":"2014-04-04T05:10:41","slug":"cant-use-sql-serverce-in-visual-studio-project-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/04\/cant-use-sql-serverce-in-visual-studio-project-collection-of-common-programming-errors\/","title":{"rendered":"Can&#39;t use Sql ServerCE in Visual Studio Project-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn Quick Background: I recently upgraded to VS 2008 Pro.\u00a0 The first install caused a lot of problems on my machine, so I had to wipe it out and reinstall.\u00a0 Now everything works okay (except for below), though\u00a0sometimes there are\u00a0unusually long\u00a0pauses for certain functions.\u00a0 I originally posted on VS Install forum but I think this might be a better place.<\/p>\n<p>I cannot add or work with Sql Server CE databases in VS 08 (full Sql server databases appear to be ok so far).\u00a0 I can add a local database to my project &#8211; sometimes it will give this error after naming it:\u00a0 &#8220;An error occured when retrieving the information from the database:\u00a0 Exception has been thrown by the target of an invocation.&#8221;\u00a0 But then it still shows up in Server Explorer.\u00a0\u00a0 If I attempt to\u00a0view the database from there (such as refresh or edit tables) I again always\u00a0get the msgbox error &#8220;Failed to retrieve data for this request.&#8221;\u00a0 I wonder if this is an installation issue as I&#8217;m not sure what else it could be.<\/p>\n<\/li>\n<li>\n<h3>15 Answers<\/h3>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn1<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn2 Hi, Please let me know you are working with VS 2008 or VS 2008 Sp1?Please try to\u00a0repair 1. VS (itself)2. Install\\Repair SQL Compact tools from WCU\\SSCE 3. Install\\Repair SQL Compact\u00a0Runtime from WCU\\SSCE4. Reinstall VS Sp1 patch is you are uinsg VS2008 Sp1. Please let me know if you still have any issues. Thanks &amp; Regards<\/p>\n<p>Devesh Anand<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn3<\/p>\n<p>Following the link of Imram (and\u00a0other posts) I attempted to install Tools and Runtime from WCU\/SSCE.\u00a0 However, I got the error message &#8220;A later version is already installed.&#8221;\u00a0 I had versions 5692 in accordance with Anand&#8217;s advice.\u00a0<\/p>\n<p>So, I\u00a0removed SSCE Tools and Runtime, then reinstalled them from WCU\/SSCE.\u00a0 Now everything works.\u00a0 However, my versions for these are now 5386, not 5692, even though I have VS08 SP1.<\/p>\n<p>So now everything is working, even though the version numbers are not as suggested above.\u00a0 I&#8217;m not sure what to make of that.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn4 <strong>&#8220;Can you please update us on whether you are able to use Server Explorer to create and edit SQL CE database directly.&#8221;<\/strong>I can add SQLCompact database to my project using the &#8216;Add item&#8217; from the\u00a0VS menu\u00a0(with error message in original post).\u00a0 However, if I go to Server Explorer and do &#8216;Create Connection&#8217; then choose &#8216;SQL Server Compact 3.5&#8217;, after entering the new database name and pressing &#8216;Create&#8217;, the menu just disappears and nothing happens, not does the database show up in Server Explorer.\u00a0 From online guides I think the process is supposed to continue with another menu.<\/p>\n<p>When I try to add a table with Server Explorer, after entering in table and column names and clicking &#8216;OK&#8217;, I get the usual message of &#8220;Failed to retrieve data for this request.&#8221;\u00a0 <em>However<\/em>, the table must have been created, because if I go back and try to add the table again with the same name, I get a &#8216;table name already exists&#8217; error.\u00a0 But, no tables ever appear in Server Explorer, just the &#8220;failed to retrieve data for this request&#8221; when expanding table folder.\u00a0<\/p>\n<p>Again, for normal SQL Server databases on our network, I can see all the tables fine with no error messages.\u00a0 I will continue to look at the repair options you guys have given.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn5<\/p>\n<p>Imram, I downloaded from your link and it said I have a later version on my machine.\u00a0\u00a0I have SQL Compact 3.5 SP1.\u00a0 I tried to repair with that but the problem remains.\u00a0 I am trying a complete repair of VS now.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn6 Thanks for the reply.\u00a0 I am\u00a0confused on a few points.\u00a0 This is what is listed in Add\/Remove:1.\u00a0 Microsoft SQL Server Compact 3.5 for Devices ENU2.\u00a0 Microsoft SQL Server Compact 3.5 SP1 Design Tools English3.\u00a0 Microsoft SQL Server Compact 3.5 SP1 EnglishIs #2 what you mean when saying SQL Compact Tools?\u00a0 Or\u00a0do you mean\u00a0Sequel Server CE Server Tools?\u00a0\u00a0Also, I bought VS08 recently and it installs VS SP1 automatically, so I do not think I can repair VS and VS SP1 separately.\u00a0<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn7 I am 98% sure that I did default installation; I do not remember changing any of the default settings, nor would I have any reason to do so.I have both versions you mentioned above:\u00a0 Compact 3.5 for Devices 5386 and the 5962 SP1 installed.I have now run repair for all VS, as well as repair for just SQL Server Compact 3.5 multiple times.\u00a0\u00a0\u00a0\u00a0So,\u00a0I have 3.5 for\u00a0Devices, but apparently not 3.5 for Desktop\u00a0for some reason.\u00a0 You guys have mentioned both and I&#8217;m not sure of their relationship.\u00a0 Should I have both Desktop and Devices, or just one, or does it make a difference?\u00a0 Should I try to find and download the Desktop?<\/p>\n<p>If all else fails, I will probably reimage my cpu and start over, but of course hopefully it does not come to that.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn8<\/p>\n<p>Sorry to jump in on this thread but I am getting a very similar issue.\u00a0 I can progmatically create SQLCE databases fine but when it comes to trying to add them as a data source I get the dreaded &#8220;Exception has been thrown by the target of an invocation&#8221; on the &#8216;Choose Your Database Objects&#8217; page of the Data Source Configuration Wizard.\u00a0 This also happens on the Northwind sample database.\u00a0 I have googled for hours with no luck so am at a loss :(Is this the same issue perhaps?As Tekito I have done a full repair of VS2008 Pro and reinstalled Compact 3.5 (I am only running it as a desktop client, no mobile devices).<\/p>\n<p>Running Vista sp1 32bit<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn9<\/p>\n<p>1. &#8220;Microsoft SQL Server Compact 3.5 for Devices ENU&#8221; is Compact 3.5 for devices (version 5386 is RTM, version 5692 is SP1)2.\u00a0&#8220;Microsoft SQL Server Compact 3.5 SP1 Design Tools English&#8221; is Compact 3.5\u00a0Tools (version 5386 is RTM, version 5692 is SP1)3. &#8220;Microsoft SQL Server Compact 3.5 SP1 English&#8221; is Compact 3.5 for Desktop\u00a0\u00a0(version 5386 is RTM, version 5692 is SP1)<\/p>\n<p>1. Compact 3.5 for devices contains Runtime cabs for the Devices programming (only required to program against devices)<\/p>\n<p>2. Compact 3.5 tools is for integration of SQL Compact runtime with VS (required)<\/p>\n<p>3. Compact 3.5 for\u00a0desktop is runtime for desktop (required )\u00a0<\/p>\n<p>IF YOU ARE USING <strong>VS08SP1<\/strong> NEED TO HAVE\u00a0<strong>SP1<\/strong> VERSION OF <strong>#2 AND #3<\/strong> (5692)<\/p>\n<p>Thanks &amp; regards,<\/p>\n<p>Devesh Anand<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn10<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn11<\/p>\n<p>Many thanks, re-installing SP1 fixed the glitch for me..<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn12 Tekito,Has your problem got resolved. Thanks &amp; Regards<\/p>\n<p>Devesh Anand<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn13<\/p>\n<p>Following the link of Imram (and\u00a0other posts) I attempted to install Tools and Runtime from WCU\/SSCE.\u00a0 However, I got the error message &#8220;A later version is already installed.&#8221;\u00a0 I had versions 5692 in accordance with Anand&#8217;s advice.\u00a0<\/p>\n<p>So, I\u00a0removed SSCE Tools and Runtime, then reinstalled them from WCU\/SSCE.\u00a0 Now everything works.\u00a0 However, my versions for these are now 5386, not 5692, even though I have VS08 SP1.<\/p>\n<p>So now everything is working, even though the version numbers are not as suggested above.\u00a0 I&#8217;m not sure what to make of that.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn14<\/p>\n<p>My problem appears resolved.\u00a0 I just thought\u00a0it might be worth noting\u00a0that it was resolved with\u00a0versions 5386 instead of 5692.\u00a0<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/i.msdn.microsoft.com\/dn186180.LOGO_Win1211(id-id,MSDN.10).png\" \/><br \/>\nmsdn15 Tekito &amp; Deano, I find this strange that Compact SP1 3.5.5692 is not working with VS08 SP1. Did you try reinstallating VS08-SP1?I wanted to connect with you to discuss this in more deatils. Please send me a test mail:\u00a0 devesha{at}microsoft.comI would like to resolve your problem (using Compact 3.5 SP1). Thanks &amp; Regards,<\/p>\n<p>Devesh Anand<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>msdn Quick Background: I recently upgraded to VS 2008 Pro.\u00a0 The first install caused a lot of problems on my machine, so I had to wipe it out and reinstall.\u00a0 Now everything works okay (except for below), though\u00a0sometimes there are\u00a0unusually long\u00a0pauses for certain functions.\u00a0 I originally posted on VS Install forum but I think this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5621","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5621"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5621\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}