Sql connection can not open why?

I use the following source code to connect sql database, but the connection can not open, can somebody help me? thanks.
SqlCeConnection con = new SqlCeConnection("Data Source="
                + System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "Sampledatabase.mdf"));
            con.Open();
OR
SqlCeConnection con = new SqlCeConnection(@"Data Source=|DataDirectory|\Sampledatabase.mdf");
con.Open();

Hi Sunny,
Based on your code, your case related to how to connect to an MDF database file?
The keypoint is how to write the connectionstring.
Here is a sample,
con.ConnectionString = @"Data Source=.\SQLEXPRESS;
AttachDbFilename=c:\folder\SampleDatabase.mdf;
Integrated Security=True;
Connect Timeout=30;
User Instance=True";
From your second code with DataDirectory
Note the filepath should have |DataDirectory| which actually links to "current project directory\App_Data\" or "current project directory" and get the .mdf file.
Best reagrds,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How come my Nikon D610 can not open photoshop CS6 raw files

    any one know,i just bough a New Nikon D610 digitalcamera, i am upload in to Photoshop CS6 raw file, but can not open,why?

    Nikon D610 support is coming in the next version of Adobe Camera Raw 8.3
    http://labs.adobe.com/technologies/cameraraw8-3/?tabID=details#tabTop
    You can download the Release Candidate version from
    http://labs.adobe.com/technologies/cameraraw8-3/

  • Please i can not open my CC on my PC ? Why ?

    Sorry but, i can not open CC today
    "déconnexion" ????? why ? what ?
    i am not déconnected ...
    please help me, i want update the CC today
    Thank you very much
    please in french langage  ....

    Bonjour
    Bonjour
    Merci pour votre réponse
    J'ai mis de nouveau CREATIVE CLOUD sur mon PC
    Donc, j'ai maintenant ADOBE Creative Cloud sur moi deskop et je peux ouvrir celui-ci.
    Mais maintenant NOUVEAU CC! c'est un problème? je suis bien enregistrée chez vous avec mes n° de série, et mon abonnement mensuel, je ne souhaite pas en avoir un 2ème, sommes nous bien d'accord ??  Si c 'est un problème d'avoir ré-installer ADOBE CREATIVE CLOUD, dîtes le moi svp, merci
    merci pour la réponse et désolée, je n'arrive pas à joindre la copie d'écran dans le message ???    c'est noté DECONNEXION
                                                                                                                                                                                     veuillez vous connectez
    et quand j'essaie, cela ne fonctionne pas, j'ai toujours la page d'ouverture de CC qui me demande de me connecter.
    Best regards,
    Christiane

  • Have used cloud with CS5.5. Not longer have cloud can not open any of my creative CS5.5 folders. Why? and how do I fix it?

    As a student enrolled and used the Cloud. already had CS5.5 Creative suite installed on computer. Now that I'm no longer a student and No Longer have Cloud I can not open any of my folders with work in them. It wants me to up dated my subscription. I cant afford it right now.
    I want to use the programs I have already paid for. . Creative Suite CS 5.5.
    Why can't I open those folders/work and how do I fix it.

    if you don't have cs5.5 installed, you can download and install it.
    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 | 12 | 11, 10 | 9, 8, 7 win | 8 mac | 7 mac
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7 win | 8 mac | 7 mac
    Lightroom:  5.6| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • Why is my iPad suddenly not opening the Yahoo home page? I get a message saying Safari can not open the page due to too many redirects. This started yesterday. I shut my iPad down and still no luck.

    Why is my iPad suddenly not opening the Yahoo home page? I get a message saying Safari can not open the page due to too many redirects. This started yesterday, and I have already tried shutting off my iPad.

     

  • I am running Vista and Windows Mail, I can not open PDF files when in Windows Mail, I must save to Desktop first, this has changes recently and I do not know why or how to fix

    I am running Vista and Windows Mail, I can not open PDF files when in Windows Mail, I must save to Desktop first, this has changes recently and I do not know why or how to fix.
    Why after 6 year's this has changed?
    I would like to open PDF's straight from Window Mail.

    Good day Jeff.
    I am running most current Adobe Reader X.
    Tks Mark

  • I have Creative Cloud installed and Photoshop installed, but I can not open the program itself. No idea why, everything is up to date and i was using it just fine yesterday.

    I have Creative Cloud installed and Photoshop installed, but I can not open the program itself. No idea why, everything is up to date and I was using it just fine yesterday.
    2015-02-24_1129 - DavidIpromote's library

    Try resetting Photoshop Preferences.   Use your Photoshop start icon to launch Photoshop and immediately press and hole Shift+Ctrl|CMD+Alt|Option keys   Photoshop should Prompt you with Do you want your Preferences deleted. Reply yes.   Photoshop should then delete your user ID preferences and then create a default set of preferences for your ID and start successfully.

  • I can not open itunes without quicktime 7.5.5 why ?

    i can not open itunes without quicktime 7.5.5 why ?

    You don't provide us with much background infomation such as operating system version you are using, but usually when I see this kind of question it gets answered by:
    QuickTime 7.5.5 for Leopard - http://support.apple.com/kb/DL27
    QuickTime 7.7 for Leopard - http://support.apple.com/kb/dl761
    = New version of Quicktime installed but application reports it needs to have that version installed =
    Open Application > Utilities > System Profiler and check the Quicktime version in Frameworks vs. the version in Applications.  I recently helped where the person had re-installed their operating system.  It had kept the newer Player application but had reverted to an earlier version of the underlying support framework files which many applications utilize.  Re-installing Quicktime 7.7 took care of the problem.  Do this manually, not with Software Update.
    Installation get stuck at "configuring installation" - https://discussions.apple.com/thread/2592979?threadID=2592979  - uninstall Quicktime before installing.

  • HT4157 My iPad. Oonnects to other wifi it used to connect to my work wifi but it will. Not connect now what is work I am connected with my iPhone but iPad will. Not connect or it says safari can not open page

    I can connect my iPhone to my work wifi but when I try to connect my IPad it will not connect. It says safari can not open page.  What's up with that I have used IPad connected to work wifi before

    Look at iOS Troubleshooting Wi-Fi networks and connections  http://support.apple.com/kb/TS1398
    iPad: Issues connecting to Wi-Fi networks  http://support.apple.com/kb/ts3304
    iOS: Recommended settings for Wi-Fi routers and access points  http://support.apple.com/kb/HT4199
    Additional things to try.
    Try this first. Turn Off your iPad. Then turn Off (disconnect power cord for 30 seconds or longer) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
    Go to Settings>Wi-Fi and turn Off. Then while at Settings>Wi-Fi, turn back On and chose a Network.
    Change the channel on your wireless router (Auto or Channel 6 is best). Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
    Another thing to try - Go into your router security settings and change from WEP to WPA with AES.
    How to Quickly Fix iPad 3 Wi-Fi Reception Problems
    http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
    If none of the above suggestions work, look at this link.
    iPad Wi-Fi Problems: Comprehensive List of Fixes
    http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
    Fix iPad Wifi Connection and Signal Issues  http://www.youtube.com/watch?v=uwWtIG5jUxE
    Fix Slow WiFi Issue https://discussions.apple.com/thread/2398063?start=60&tstart=0
    Unable to Connect After iOS Update - saw this solution on another post.
    https://discussions.apple.com/thread/4010130
    Note - When troubleshooting wifi connection problems, don't hold your iPad by hand. There have been a few reports that holding the iPad by hand, seems to attenuate the wifi signal.
    ~~~~~~~~~~~~~~~
    If any of the above solutions work, please post back what solved your problem. It will help others with the same problem.
     Cheers, Tom

  • Why can I not open pictures when I click on the host icon on my desktop? It just sits there, and can not open from top menu bar as well, only via itunes

    why can I not open pictures when I click on the host icon on my desktop? It just sits there, and can not open from top menu bar as well, only via itunes

    Does your question involve iPhoto in some way?

  • TS1506 In most of my email attachment the logo ( Mimi attachment ) show and I can not open that attachment , why and how to solve this problem ??? iPad 2, iOS 7

    In most of my email attachment the logo ( Mimi attachment ) show and I can not open that attachment , why and how to solve this problem ???
    iPad 2, iOS 7

    When did this start?  What was the last thing you changed before problem started?
    Have you tried sending the attachment from a different account.  Have a friend send you an attachment. Get a gmail account.
    Send the email with attachments to two different accounts one to your ipad and the other to a gmail account in a web browser and not on an iPad.  See if you can read the ones to the gmail account.
    You did reboot your ipad?
    Standard stuff for ipad.
    http://www.my-iguru.com/ipad/ipad-hints-tips/ipad-viewing-saving-email-attachmen ts.php

  • I can not open different sites after installing itunes. Why?

    I can not open different sites after installing itunes. I can`t open google.com or youtube.com. Why?

    Before anyone can help, they need information to work with. Basic stuff: What version of iPhoto. What version of the Operating System. Details. What were you doing when the problem arose? Did it ever work properly? Step-by-step descriptions of how you got to this issue. If something doesn't work, are there error messages? What happens when you try to do this thing? And what steps have you tried already to solve the issue. With this kind of information somebody can develop a starting point for troubleshooting the issue.
    Posts that consist of "iPhoto doesn't work. Help" or "iPhoto won't print" or "Suddenly I have no photos!!!!!!!!!!" mean that a helper is simply guessing. With information, s/he may be able to get your issue resolved sooner.

  • Can i help u? i had bought camfrog pro app by itunes...i see that app is upgrade now. but i can not upgrade that app...i can see this message "can not open by This id" i don't know why can not upgrade camfrog pro by my korea id? plz answer me

    can i help u? i had bought camfrog pro app by itunes...i see that app is upgrade now. but i can not upgrade that app...i can see this message "can not open by This id" i don't know why can not upgrade camfrog pro by my korea id? plz answer me

    To Update the App you have to Use the Same Apple ID it was Purchased with...

  • Why I can not open youtube apps in my iPad air? Anyone can help?

    first thing happened was I can not open the youtube apps here in my iPad air. Then I try to delete it then install again but same thing happens. Then I try to refresh my iPad but still same thing happen again I can't open. Then I figure it out that maybe I need to update my software device from ISO 7 to ios 8 but worst thing happened. I can't open the YouTube apps again and my movie box apps I can't open also. And my iCloud settings i can't access also beacause they said need to check my email and verify my iCloud settings. But worst thing happen is I forgot my password in my email.. god! Can anyone help me pls of what I'm going to do? To fix this problem? Thank you!

    You do NOT need to restore your iPad.
    I believe that the problem is that there is a disconnect with your iTunes account and your iPad. What you are experiencing is a somewhat common issue after you sync your iPad, update your device - it could be a number of reasons that are causing it. the recommended fix is to download another app in order to "reconnect" your ID and iTunes account to the iPad.
    You can read more about it here. You will need a WiFi internet connection in order to fix it - or you have to be able to sync with your own iTunes library.
    iOS: Troubleshooting applications purchased from the App Store
    But this is what it says in the article.
    3. Install another app from the App Store
    If none of your user-installed apps will launch, there could be an issue with Apple ID authorization. Download and install a free (or paid) app that isn't already installed on your device to reset this information. You could also remove an app from your iOS device and download it again from the App Store or sync the app from your computer.
    Note: If you have installed apps using multiple Apple ID accounts, you may need to perform this step for each account.

  • Why I can not open the downloaded applications in my iphone 4s?

    Why I can not open the downloads applications? Please show me the way.

    why you cant open? what does it says? have you tried using an valid apple id?

Maybe you are looking for