Sunday, March 25, 2012

Data Source error?

Hey everyone,

Just wondering if anyone could answer a simple question for me. Here is a brief background on what I'm trying to do and my setup. I'm working with .net studio 2005 and Windows Mobile 2005. I'm just doing some testing with SQLCE for future projects that I plan to implement with it. I'm somewhat new to .net, however I have experience in VS6.0. I wrote a simple app that contains Data Binding and was attempting at Datasets on a Mobile device, but I ran across some error. However that error I'm not concerned with yet. The error that I'm concerned with is tring to implement the same project except connecting to a mobile database on the desktop. I created a database called Tech that is a mobile database sitting in MyDocuments. In the Server Explorer window the database shows that I'm connected to it. I can using Databinding just fine, however when I try to connect through code I get an error saying "Data Source not found". At first I thought maybe my connection string is wrong .. well I don't think it is. If I look at the project window Tech.sdf shows up but it looks as if the icon is a unknown file type. I don't think this would be the case being that DataBinding works however .. you never now. This is how I'm attempting to connect with out any trys and catches though.

Dim Conn As SqlServerCe.SqlCeConnection

Dim DA As SqlServerCe.SqlCeDataAdapter

Dim DS As New DataSet

Conn = New SqlServerCe.SqlCeConnection("Data Source = Tech.sdf")

DS = New SqlServerCe.SqlCeDataAdapter("Select * from User", Conn)

Conn.Open()

Nothing advance just tring to do a simple connection so that I can fill a DataSet. I have also tried placing the complete file path for the connection string with no luck. The DB has no password or anything. Just keeping it straight forward as possible while I try to conquer this learning curve. Any clue?

I know you might have tried a lot to get out of this problem. But this error simply means that it can not find the file Tech.sdf!

Please try to put Tech.sdf in the very root folder (\Tech.sdf) and try out that path!

Thanks,

Laxmi Narsimha Rao ORUGANTI, MSFT, SQL Mobile, Microsoft Corporation

|||

Thank you for the response, however I have already tried placing the complete path for the Data Source. I went ahead placed the file in the root directory also to see if that would work by chance, but no luck. I believe the problem exist becuase the .sdf is a unknown file type on my desktop or maybe the .sdf needs to be on the Device Emulator to work? I have used Virtual PC before and I'm not sure if the same concept applies with this Emulator where you have to copy the files over to that device. The Pocket PC 2003 Emulator seems to have it's on seperate files structure but I'm not sure where I can access this.

|||Figured it out. I needed to have the .sdf on the Emulator. There is a tool in the CE Remote Tools folder called ccfilevw that allows me to export a file to the Emulator. I'm not sure if there is a easier way or better way but this works.

No comments:

Post a Comment