GavinS
asked on
Opening .SDF files with SQL Server Express - C#
Hi Guys,
I'm trying to open a .SDF datadase file. The file was previously created on a PDA and subsequently transfered to my laptop where I have SQL Server Express installed.
In the application on my laptop, I define the SQL connection like this:
String FileName="C:\\Datafolder\\ MyDataFile .sdf";
ShiftFileConnection = new SqlConnection("server=SCAM LT001\\SQL EXPRESS;"
+ "Trusted_Connection=yes;"
+ "data Source=" + FileName);
ShiftFileConnection.Open() ;
When I call the .Open() method, an exception occurs with the following error message:
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
I suspect I just haven't got the connect string quite right, but I've tried numerious connect strings without any success. - Can someone kindly review my connect string and point out the error. -Thanks
I'm trying to open a .SDF datadase file. The file was previously created on a PDA and subsequently transfered to my laptop where I have SQL Server Express installed.
In the application on my laptop, I define the SQL connection like this:
String FileName="C:\\Datafolder\\
ShiftFileConnection = new SqlConnection("server=SCAM
+ "Trusted_Connection=yes;"
+ "data Source=" + FileName);
ShiftFileConnection.Open()
When I call the .Open() method, an exception occurs with the following error message:
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
I suspect I just haven't got the connect string quite right, but I've tried numerious connect strings without any success. - Can someone kindly review my connect string and point out the error. -Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That fixed it. I didn't think the SQLce libraries would work for conventional windows applications.