1System.Data.SQLite.SQLiteConnection Conne =NewSystem.Data.SQLite.SQLiteConnection ();2System.Data.SQLite.SQLiteConnectionStringBuilder connstr =NewSystem.Data.SQLite.SQLiteConnectionStringBuilder ();3ConnStr. DataSource = System.AppDomain.CurrentDomain.BaseDirectory +"//db//course.db";4Conne. ConnectionString =ConnStr. ToString ();5 Conne. Open ();6 7System.Data.SQLite.SQLiteCommand cmd =NewSystem.Data.SQLite.SQLiteCommand ();8 9 stringsql ="Select * from userlogininfo WHERE useraccount = '-------'";TenCmd.commandtext =SQL; OneCmd. Connection =Conne; A -System.Data.SQLite.SQLiteDataAdapter adapter =NewSystem.Data.SQLite.SQLiteDataAdapter (cmd); -DataSet data =NewDataSet (); the adapter. Fill (data); -DataTable table = data. tables[0]; - - BOOLHasshowaccount =false; + for(inti =0; I < table. Columns.count; i++) - { + if(table. Columns[i]. Columnname.equals ("Showaccount")) A { atHasshowaccount =true; - } - } - - if(!hasshowaccount) - { insql ="ALTER TABLE userlogininfo add column Showaccount CHAR (a)"; -Cmd.commandtext =SQL; to cmd. ExecuteNonQuery (); + } -Conne. Close ();
C # for existing SQLite databases, whether a column exists in a particular table,