■ SQLite 버전을 구하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
using System; using System.Data.SQLite; string connectionString = "Data Source=:memory:"; SQLiteConnection sqliteConnection = null; SQLiteCommand sqliteCommand = null; try { sqliteConnection = new SQLiteConnection(connectionString); sqliteConnection.Open(); string sql = "SELECT SQLITE_VERSION()"; sqliteCommand = new SQLiteCommand(sql, sqliteConnection); string version = sqliteCommand.ExecuteScalar().ToString(); Console.WriteLine("SQLite version : {0}", version); } catch(SQLiteException sqliteException) { Console.WriteLine("Error: {0}", sqliteException.ToString()); } finally { if(sqliteCommand != null) { sqliteCommand.Dispose(); } if(sqliteConnection != null) { try { sqliteConnection.Close(); } catch(SQLiteException sqliteException) { Console.WriteLine("Closing connection failed."); Console.WriteLine("Error: {0}", sqliteException.ToString()); } finally { sqliteConnection.Dispose(); } } } |