本文整理汇总了C#中Microsoft.Data.Sqlite.SqliteConnection.ExecuteNonQueryAsync方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteConnection.ExecuteNonQueryAsync方法的具体用法?C# SqliteConnection.ExecuteNonQueryAsync怎么用?C# SqliteConnection.ExecuteNonQueryAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Data.Sqlite.SqliteConnection
的用法示例。
在下文中一共展示了SqliteConnection.ExecuteNonQueryAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDatabaseAsync
private async Task CreateDatabaseAsync(SqliteConnection connection)
{
await connection.CreateCommand("BEGIN; SELECT InitSpatialMetaData(); COMMIT;").ExecuteNonQueryAsync();
await connection.ExecuteNonQueryAsync(@"
CREATE TABLE IF NOT EXISTS IPRangeProviders (
Id INTEGER NOT NULL PRIMARY KEY ASC,
Name TEXT NOT NULL
);
").ConfigureAwait(false);
await connection.ExecuteNonQueryAsync(@"
CREATE TABLE IF NOT EXISTS Areas (
Id INTEGER NOT NULL PRIMARY KEY ASC,
Name TEXT NOT NULL,
NamesByCultures TEXT,
Kind INTEGER NOT NULL,
Code TEXT,
AdminAreaLevel1Id INTEGER,
AdminAreaLevel2Id INTEGER,
CountryId INTEGER
);
CREATE INDEX IF NOT EXISTS IDX_Area_Kind ON Areas (Kind);
SELECT AddGeometryColumn('Areas', 'Coordinates', 4326, 'POINT', 'XY');
SELECT CreateSpatialIndex('Areas', 'Coordinates');
").ConfigureAwait(false);
await connection.ExecuteNonQueryAsync(@"
CREATE TABLE IF NOT EXISTS IPRangeInfos (
AreaId INTEGER NOT NULL,
ProviderId INTEGER NOT NULL,
StartLow INTEGER NOT NULL,
StartHigh INTEGER,
EndLow INTEGER NOT NULL,
EndHigh INTEGER
);
").ConfigureAwait(false);
}