.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Connect connect to sdf file in C# 2010.

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
Hi all, im getting nowhere fast (i've read pages of google, msdn, daniweb...., etc) yet no one seems to have answered a question that sorts out my problem, so any help would be great. Thanks in advance. Background: Developing a desktop app in Visual C# 2010, that allows a user to add / edit / delete from a database. I have it working great when using a SQL Server 2008 R2 database (.mdf database). But now I want to connect to a .sdf local (ie in the same directory as my app code) database and no matter what I try for my connection string it just gives me the following error 'A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)' yes there are other posts that have this error but none of the answers seem to help me. im using SQL Server Compact 3.5. Ive added using System.Data.SqlServerCe;       I have tried the following recommended connectionstring: SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=|DataDirectory|\\MotDatesDatabase.sdf; Persist Security Info=False"; and also a few other that have the full data path in them, one

View Complete Post

More Related Resource Links

InfoPath 2010 cannot connect to SharePoint 2010

You have installed Office 2010 beta and you are trying to connect to SharePoint 2010 from InfoPath but you get an error

Quick Note: Connect Web Parts in SharePoint 2010

Learn to create and deploy two Web Parts and then connect them so that making in a selection in one displays that selection in the other.

Unable to connect a web service from SharePoint 2010

Hi, I have a requirement to connect to a webservice from SharePoint 2010 without passing Network credentials explicitly. If i am already logged into the SharePoint 2010 portal , I should be able to click on Search (which is a web service which retrieves search results from Oracle UCM) and retrieve the result. I tried localhost.ServiceX myProxy = new localhost.ServiceX(); myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; also myProxy.UseDefaultCredentials = True Still i am unable to authenticate. Default credentials returns null value.   Kindly help.

SharePoint Designer 2010 errors out when trying to connect to SharePoint 2010

When trying to connect Designer 2010 to our SharePoint 2010 we have setup here, the web seems to open, but then it bombs out with an error "An error occurred while trying to fetch data from your SharePoint site. Unknown response from the server.". And we're stuck as of now. Noting this bombs out also from Designer 2010 on the server, as well as from my workstation, so it's some sort of service issue.We've done:1) Firewalls off, on both server and my desktop2) I've been made admin everywhere, including the farm admin. Doesn't just die on my user, but all users get same error.3) Clicking lots of checkboxes in hundreds of places :)Any thoughts as to why designer dies?NotingThat when I Open Site in Designer 2010, and put the Url in the Site Name, the folder structure does show the folders of the site, so I can see images, _catalogs, SitePages, etc. It's just when trying to connect is when it doesn't work.

Infopath 2010 cannot connect to Rest web service

Hi all, I recently tried to access an Excel spreadsheet range as a Rest web service in Infopath 2010; no luck.  Here are the steps I followed: 1. [Successful] Upload Excel spreadsheet with the said ranges onto a Sharepoint document library 2. [Successful] Bind the Excel spreadsheet range (I have one called Regions) in the Sharepoint document library as a Rest web service in Infopath form's listbox control during design time as follows - http://mosscrm/sites/sandbox/_vti_bin/excelrest.aspx/eventbudgets/lookups.xlsx/model/ranges('Regions')?$format=atom 3. [Failed] Then I tried to preview the form, but the actual data in the Excel range failed to populate the Infopath listbox control.  The error I got was: "Could not open "http://<localhost>/sites/<site name>/_vti_bin/ExcelRest.aspx/EventBudgets/Lookups.xlsx/Model/Ranges('EventTypes')?$format=atom"   The error I then got from Infopath was a pop-up saying: The query cannot be run for the following DataObject: Event Types InfoPath cannot run the specified query. The file is not a valid XML file. Not enough storage is available to process this command . If anyone out there has experienced a similar issue and resolved it, please kindly share your solution approach. Thanks.

SharePoint 2010 Connect to Office not creating shortcut in SharePoint Sites folder

When I click on the Connect to Office in a  SharePoint Library and select add to SharePoint Sites, the link is no longer creating.  This worked one time, but after I selected Remove from SharePoint Site I am no longer able to add any sites by this method.  Any thoughts? Thanks!

Cannot connect SharePoint 2010 site with Office 2010 beta

I installed Office 2010 beta, then want to new a workspace of SharePoint 2010 beta. An error pop-up: SharePoint workspace cannot sync with the specified SharePoint site because its server version is not supported.My SharePoint 2010 beta is the only web front end server in a farm environment. I started all the SharePoint related services, but the error pop-up anyway...

Tell Me it aint so - VS 2010 Express cannot connect to my Host Sql Server

I just bought a new computer, so I decide to install the 2010 Express version of everything.  But I cant make C# connect to my Sql database located at on my on website.  I just connected to it via Mananagement console, so I know its there and working.  I read one posting comment that Im going to have to purchase VS.  If thats true, Im going back to my old version of Visual Studo.

Connect vwd 2010 to remote iis 7.5


How do I connect to a remote site in IIS 7.5 using vwd 2010?  vwd 2010 appears to be looking for deprecated software instead of the IIS 7.5 supported protocol using webdav.  My application uses a cookie authentication from a central corporate authority and nothing but a legitimate URL is going to work during debugging.  There is almost no information in a google search and the only forums.asp.net post from last year says it isn't possible.  If MS is no longer supporting FPSE in the new versions of IIS, then what is vwd 2010 doing looking for it--is there a patch or module of some kind that is available to enable webdav access?

Can not connect to ReportServer. HTTP 404 - File not found

I am running SQL Server 2008 Express.

I notice it did not create the reportserver directory in the Default Web Site.  I read one solution that said to go in Reporting Services Configuration Manager and click on the New button.  I can not find the New button.

I think the original problem was my IIS server was not working right so I reinstalled it.  It is working now.  How do I get Reporting Services to recreate the directories?

Thanks for any help,


"Connect to Oultook" missing in Sharepoint 2010

I'm trying to connect an External List in Sharepoint 2010 to MS Outlook 2010, but the "Connect to Outlook" button is missing.

Stuck installing Sharepoint 2010 - Config Wizard saying Cannot connect to database master


Hi all

I have setup 2 servers in hyper-v.
SERVER-SHP = Sharepoint 2010
both running on windows server 2008 R2.
Both servers are joined to the same domain, have fixed ip addresses and can ping each other.

When I get to the part in Sharepoint 2010 setup where I'm runnng "Sharepoint Products Configuration Wizard" where I specify the database server and name and username and password I get the following error which I can't get past "Cannot connect to database master at SQL server at SERVER-SQL. The database might not exist, or the current user does not have permission to connect to it."

I have read the following link and followed it but the problem remains

I don't see where it is falling over as the username and password is the domain administrator one (have also tried the spAdmin) mentioned to setup in the above link. And it says at the notes at the top of the page that if the database (SharePoint_Co

PowerPivot Report is unable to connect database after uploading onto SharePoint 2010


Hi All,

I have developed one PowerPivot Report in excel 2010 and uploaded into SharePoint 2010. The report has slicers and filters which are working pretty well in excel 2010.

I'm able to open the report through sharepoint browser and  if click on any slicer getting the following error.

An error occurred during an attempt to establish a connection to the external data source. The following connections failed to refresh:

Also i'm unable to see the filter on the report.

I have got some info on google regarding 'Claims to windows token service' should up and run. But, i'm still getting the same after enabling 'Claims to windows token service' as well.

Please help me in this regard.

Thanks & Regards,


Connect to Outlook feature in SharePoint 2010 still using .pst files?


The Connect to Outlook feature in SharePoint Server 2007 uses a .pst file to store content that is visible in Outlook. This has caused issues in the past with a client's enterprise policy of preventing use of .pst files on desktops. This particular client has an application that periodically checks for .pst files and deletes them, which breaks the Connect to Outlook feature for them.

Does SharePoint 2010 use the same functionality to Connect to Outlook, or something different?

Not able to Connect Access 2010 or Sharepoint Designer 2010 to the Local SP 2010 Development Environ


I was able to install and configure SP 2010 Foundation on a Windows 7 Home Premium Edition as a Development Environment.  But I am facing  following issues:

a)cannot export lists from Access DB (Reason not able to connect to the local site on my machine) 

b) for a list on SP site can't "Open with Access" - Access application is triggered, but the list doesn't show-up.

c) open a Page or List for edit with Sharepoint Designer ( SharePoint Designer application gets triggered  but it get message "Unable to open Web site, Possible Causes: ..."

d) Also "Open Site" for local site on my machine gives the same error as in point c) above. 

These 4  unsuccessful operations happen only for the local development site (created on my laptop), all the above operations are successful though when I do them on a web hosted SP 2010 site. I have given "Full Control" permission for my login on the Central Administration. So what is wrong with the local site which prevents SharePoint Designer and Access DB connectivity? 


Windows 7/Server 2008 R2 + Office 2010 cannot connect to SharePoint 2010


I have a Windows 7 x64 machine, with Office 2010 x86 installed.  I also have (2) Server 2008 and (2) 2008 R2 machines with Office 2010 x86 installed on them. On all of these machines I can not connect to SharePoint 2010 using Office.  The following occurs:

  • From the browser, browse to a doc lib. 
  • Click on an Office document, select "Edit in Microsoft ..."
  • An "Open Document" dialogue box appears, indicating that "Some files can harm your computer. If the file information below looks suspicious, or you do not fully trust the source, do not open the file.  File Name: Whatever.docx  From: SPServer2010.  (This is the first clue that something is not working properly.  I don't think this would appear otherwise)
  • Click OK.
  • The document opens, but with a [Read-Only] in the title bar. 
  • If I click save, it tries to save to a default location on my desktop computer.

Another example of the problem:

  • Open an Office 2010 application. 
  • Click File>Open
  • In the Open dialogue box, type in the URL of a document lib on the server. 
  • The error message: You can't open this location using this program. Please try a different location.

Final example of the problem:

  • Click Upload Multiple

Can't connect to local database file .mdf using SQL Server Authentication?


Using  - Visual Studio 2005 Professional, SQL Server 2005 Express, WinForms App

Problem - I am unable to connect to SQL Server local Database file (.mdf) through  SQL Server Authentication.

Description -

I am addding a SQL Database file (local) in the c# winapp solution by right-click -> add new item -> SQL database file.

It adds the file, starts a wizard to create datasets and tableAdapters. Dataset files (.xsd) are created in solution. In the Data Connection pane along ToolBox we can see Database1.mdf.

When i right click on databse1.mdf -> Modify Connection.

It shows a form with Test Connection option. The connection gets tested for Windows Auth.But for SQL Server Auth it shows following error message -

When User Instance = True

Error 1 "Failed to generate a user instance of SQL Server. Only an integrated sonnection can generate a user instance. The connection will be closed"

When i set User Instance = False it shows this message -

Error 2 "An Attemp to attach an auto-named database for file C:\Doc&Sett\Admin\MyDocs\VS2005\Projects\SamApp\SamApp\Database1.mdf failed. A database with the same name

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend