【sqlite判断表是否存在】
SQLite语句:
SELECT COUNT(*) FROM sqlite_master where type='table' and name='Student';
如果存在,则返回数值1;
如果不存在,则返回数值0。
C#语句: 1.SQLiteCommand mDbCmd = mDbConn.CreateCommand(); 2.mDbCmd.CommandText = "SELECT COUNT(*) FROM sqlite_master where type='table' and name='Student';"; 3.if (0 == Convert.ToInt32(mDbCmd.ExecuteScalar())) 4.{ 5. //table - Student does not exist. 6.} 7.else 8.{ 9. //table - Student does exist. 10.}