views:

388

answers:

2

Hi, I am a newbie in regards to System.Data.SQLite and .NET, so bear with me. I can't seem to get System.Data.SQLite even installed correctly. The self-installer completed and everything seemed to be kosher, but nothing seems to be working. In VC# Express, I tried to create a little sample program(http://pastebin.com/m8f7cec), but it's saying that it can't find System.Data.SQLite at the line: using System.Data.SQLite;. Also the Database explorer always errors out when I try to make a new connection, starting with, "Could not load file or assembly Microsoft.VisualStudio.Data"... I also don't know what to put in the Connection string. Can someone help just get this started? I am familiar with SQLite itself.
Thanks,
deftonix

+1  A: 

You need to add a reference within your project to the System.Data.SQLite dll.

For the connection string, try http://www.connectionstrings.com, it has the format for most common connections.

Wysawyg
Isn't the reference using System.Data.SQLite;? Or am I missing something? Thanks.
deftonix
See Dillie-O's comment, you need to actually add a reference to the dll within the project. There should be a references folder, right click on that, select 'Add references..' then navigate to where the auto-extractor put the dll (or better yet set up a lib folder within your project and copy the dll there). 'Using' only specifies that that particular class can use the dll, not the project in general.
Wysawyg
Yes, that worked, however, the VC# database explorer still doesn't work correctly. I am getting the same cryptic error message no matter what Connection String I use. See here -> http://tinypic.com/r/rcsl5g/6
deftonix
A: 

All the installer does is put the proper libraries on your local machine, as well as enable the plug-ins within Visual Studio to allow you to explore your databases via Server Explorer.

You still need to Right Click on your "References" section in your project and add a reference to the library in order for it to work at runtime.

Dillie-O
Well, I feel dumb, that worked perfectly for accessing the DB through code. However, the VC# database explorer still doesn't work correctly. I am getting the same cryptic error message no matter what Connection String I use.
deftonix
Are you setting the connection string in your app.config file? The location often changes between development and runtime, and the best bet is to update the connection string there. I saw your screenshot, but it looks to be occurring when creating a new data connection. Do you get the same error when running the app?
Dillie-O