SQLite语句:
SELECT COUNT(*) FROM sqlite_master where type='table' and name='Student';
如果存在,则返回数值1;
如果不存在,则返回数值0。
C#语句:
- SQLiteCommand mDbCmd = mDbConn.CreateCommand();
- mDbCmd.CommandText = "SELECT COUNT(*) FROM sqlite_master where type='table' and name='Student';";
- if (0 == Convert.ToInt32(mDbCmd.ExecuteScalar()))
- {
- //table - Student does not exist.
- }
- else
- {
- //table - Student does exist.
- }
