2009-07-04 3 views
2

私はちょうどあなたの人のいずれかがSharpDevelopプロジェクトに統合して成功しているのだろうかと思っていましたか?そうであれば、他の人たちと経験を共有してもらうことができれば、本当に面白いでしょう。SharpDevelop内でSystem.Data.SQLiteを使用している人はいますか?

それは明らかに のVisual Web Developerの、残念ながら SQlite.NETパッケージ failsとよく果たしているが、私は、 のVisual Studio 2008 Expressのエディションやその他もろもろが、を使用しての正攻法のより多くのソートを試してみた

ビジュアルC#と作業するため、SharpDevelopは今私の唯一の希望です。

ありがとうございます。

+0

私は不思議です - それを行うには何か問題はありますか? –

+0

2時間無回答です。私は他の誰も*これをやっているとは思いません:-) – paxdiablo

+0

こんにちは、SOは**マークアップ**を許可し始めました。コメントです。カッコいい! – paxdiablo

答えて

3

多くのグーグルで、さまざまなソースとアプローチをミキシングした後、これを実現する方法を見つけました。ここで最も重要なコードの抜粋です:

/// <remarks> 
/// Creating a DataSet to feed the DataGridView 
/// </remarks>   
// 
DataSet results = new DataSet(); 
try 
{ 
    /// <remarks> 
    /// Setting the path where the database file is located 
    /// </remarks> 
    string database = "X:\\path\\to\\database\\file\\books.db"; 
    /// <remarks> 
    /// Creating a ConnectionString pointing to the database file 
    /// </remarks> 
    SQLiteConnectionStringBuilder datasource = new SQLiteConnectionStringBuilder(); 
    datasource.Add("Data Source", database); 
    datasource.Add("Version", "3"); 
    datasource.Add("New", "False"); 
    datasource.Add("Compress", "True");    
    /// <remarks> 
    /// Starting the connection and sending the query 
    /// </remarks>    
    using (SQLiteConnection connection = new SQLiteConnection(datasource.ConnectionString)) 
    { 
     using (SQLiteDataAdapter adapter = new SQLiteDataAdapter(queryTextBox.Text, connection)) 
     { 
      /// <remarks> 
      /// Populating the DataGridView 
      /// </remarks> 
      adapter.Fill(results); 
      resultsDataGridView.DataSource = results.Tables[0].DefaultView; 
     } 
    } 
} 
catch (Exception error) 
{ 
    MessageBox.Show("Exception caught: " + error.Message); 
} 
resultsDataGridViewはIDEで作成されてい

queryTextBoxは、SQL文を含むテキストボックス要素です。

System.Data.SQLite.dllとそのがディレクティブを使用して対応への参照を追加することを忘れないでください。

関連する問題