2

I am creating a program with a SQLite database.

I have connected to the database, but the table can't be found..

SQLiteConnection conn = new SQLiteConnection(@"Data Source=DataAlternatif.sqlite");
try
{
    conn.Open();
    MessageBox.Show("Succeed");
}
catch (Exception)
{
    MessageBox.Show("not Succeed");
}

Connection can be established

SQLiteCommand cmd = new SQLiteCommand(conn);
cmd = conn.CreateCommand();
cmd.CommandText = "insert into Customer (CustomerID) values (10)";

cmd.ExecuteNonQuery();

conn.Close();

Cannot find table customer.

This is the database

enter image description here

What should I do?

4

1 回答 1

0

尝试使用 db 的完整路径,如下所示

SQLiteConnection conn = 
  new SQLiteConnection(@"Data Source=E:\Kuliah 4\APH2\AHP2\DataAlternatif.sqlite;Version=3;");
于 2013-05-16T03:38:17.717 回答