Note that there are some explanatory texts on larger screens.

plurals
  1. POCode sample using DBLinq, SQLite
    primarykey
    data
    text
    <p>Would someone be able to post a small code sample that has a working connection using DBLinq, SQLite? I have been struggling to get this up and running in a VS 2010 WPF environment for 2 days now. I think I have the connection string worked out, but would love to see a sample up and running. </p> <pre><code>var con = new SQLiteConnection("DbLinqProvider=Sqlite;Version=3;Data Source=c:\\temp\\testdb.db3;"); DataSource db = new DataSource(con); var q = from c in db.Person select c; foreach (Person tempPerson1 in q) MessageBox.Show(tempPerson1.Name); </code></pre> <p>My DBML file(relevant code) - I changed the "Main" to "DataSource", and the SQLite to System.Data.SQLite.SQLiteConnection to have it compile. </p> <pre><code>[global::System.Data.Linq.Mapping.DatabaseAttribute(Name="DataSource")] [global::System.Data.Linq.Mapping.ProviderAttribute(typeof(System.Data.SQLite.SQLiteConnection))] public DbLinq.Data.Linq.Table&lt;Person&gt; Person { get { return this.GetTable&lt;Person&gt;(); } } [global::System.Data.Linq.Mapping.TableAttribute(Name="Datasource.Person")] public partial class Person { private string _id; private string _name; public Person() { } [global::System.Data.Linq.Mapping.ColumnAttribute( Name="id", Storage="_id", DbType="VARCHAR(10)")] public string ID { get { return this._id; } set { if ((this._id != value)) { this._id = value; } } } [global::System.Data.Linq.Mapping.ColumnAttribute( Name="name", Storage="_name", DbType="VARCHAR(25)")] public string Name { get { return this._name; } set { if ((this._name != value)) { this._name = value; } } } } </code></pre> <p>I am currently getting a SQLite error that there is no such table: Datasource.Person and I beleive I have the path and connect string correct. Should I have produced both a DBML file and a CS file from the DBMetal? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload