本文整理汇总了C#中SQLite.SQLiteAsyncConnection.Table方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection.Table方法的具体用法?C# SQLiteAsyncConnection.Table怎么用?C# SQLiteAsyncConnection.Table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteAsyncConnection
的用法示例。
在下文中一共展示了SQLiteAsyncConnection.Table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TaskGenerateAsync
public async Task TaskGenerateAsync(int count)
{
var connect = new SQLiteAsyncConnection(DataBaseFile);
var taskList = await connect.Table<TaskTable>().Take(count).ToListAsync();
taskList.Shuffle ();
var categoryList = await connect.Table<CategoryTable>().ToListAsync();
_tasks = new TaskList(taskList, categoryList);
}
示例2: LoadAlbumViaName
public async Task<AlbumItem> LoadAlbumViaName(int artistId, string albumName)
{
var connection = new SQLiteAsyncConnection(DbPath);
var query = connection.Table<AlbumItem>().Where(x => x.Name.Equals(albumName)).Where(x => x.ArtistId == artistId);
var result = await query.ToListAsync();
return result.FirstOrDefault();
}
示例3: CreateDatabase
private static Task CreateDatabase (SQLiteAsyncConnection connection, CancellationToken cancellationToken)
{
return Task.Factory.StartNew(() =>
{
//Create the tables
var createTask = connection.CreateTablesAsync (tableTypes);
createTask.Wait();
//Count number of assignments
var countTask = connection.Table<Assignment>().CountAsync();
countTask.Wait();
//If no assignments exist, insert our initial data
if (countTask.Result == 0)
{
var insertTask = connection.InsertAllAsync(TestData.All);
//Wait for inserts
insertTask.Wait();
//Mark database created
initialized = true;
}
});
}
示例4: acbDrugSearch_TextChanged
/// <summary>
/// For Displaying search result from database
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void acbDrugSearch_TextChanged(object sender, RoutedEventArgs e)
{
var folder = ApplicationData.Current.LocalFolder.GetFolderAsync("DataFolder");
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "DataFile.sqlite"), true);
string pillname = acbDrugSearch.Text;
if (!string.IsNullOrEmpty(pillname) && !string.IsNullOrWhiteSpace(pillname) && pillname.Length > 3)
{
var query = conn.Table<drugs>().Where(x => x.drugname.Contains(pillname));
var result = await query.ToListAsync();
if (result == null)
{
MessageBox.Show("Pill not found.");
}
else
{
List<string> drugnamelist = new List<string>();
foreach (var item in result)
{
dataReadName =item.drugname;
dataReadMilligram = item.strenght;
dataReadNameMilligram = dataReadName + dataReadMilligram;
drugnamelist.Add(dataReadNameMilligram);
}
lstDrugSearch.ItemsSource = drugnamelist;
}
}
}
示例5: Button_Click_3
private async void Button_Click_3(object sender, RoutedEventArgs e)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(ApplicationData.Current.LocalFolder.Path + "\\people.db");
var query = conn.Table<Person>();//.Where(x => x.Name == "张三");
var result = await query.ToListAsync();
listbox.ItemsSource = result;
}
示例6: ReadMessage
public async Task<string> ReadMessage(int id)
{
var connection = new SQLiteAsyncConnection(_databasePath);
var message = await connection.Table<Message> ().Where(m => m.Id == id).FirstOrDefaultAsync ();
return message?.MessageString ?? "No message stored";
}
示例7: LoadViaArtistName
async Task<MusicLibraryViewModel.ArtistItem> LoadViaArtistName(string artistName)
{
var connection = new SQLiteAsyncConnection(_dbPath);
var query = connection.Table<MusicLibraryViewModel.ArtistItem>().Where(x => x.Name.Equals(artistName));
var result = await query.ToListAsync();
return result.FirstOrDefault();
}
示例8: SetValueAsyncInternal
private static async Task SetValueAsyncInternal(string name, string value, SQLiteAsyncConnection conn)
{
// if we don't have a connection, assume the system one...
if(conn == null)
conn = StreetFooRuntime.GetSystemDatabase();
// load an existing value...
var setting = await conn.Table<SettingItem>().Where(v => v.Name == name).FirstOrDefaultAsync();
if (setting != null)
{
// change and update...
setting.Value = value;
await conn.UpdateAsync(setting);
}
else
{
setting = new SettingItem()
{
Name = name,
Value = value
};
// save...
await conn.InsertAsync(setting);
}
}
示例9: GetFirstTrackPathByAlbumId
public async Task<string> GetFirstTrackPathByAlbumId(int albumId)
{
var connection = new SQLiteAsyncConnection(DbPath);
var query = connection.Table<TrackItem>().Where(x => x.AlbumId == albumId);
var result = await query.FirstOrDefaultAsync();
return result != null ? result.Path : null;
}
示例10: OnNavigatedTo
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached.
/// This parameter is typically used to configure the page.</param>
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
bool dbExist = await CheckDbAsync("Tips.db3");
if (!dbExist)
{
await CreateDatabaseAsync();
}
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("Tips.db3");
var query = conn.Table<Tips>();
tips = await query.ToListAsync();
string title1res = tips[tips.Count - 1].title1;
string title2res = tips[tips.Count - 1].title2;
string title3res = tips[tips.Count - 1].title3;
string desc1res = tips[tips.Count - 1].desc1;
string desc2res = tips[tips.Count - 1].desc2;
string desc3res = tips[tips.Count - 1].desc3;
Tips l = new Tips { title1 = title1res, title2 = title2res, title3 = title3res, desc1 = desc1res, desc2 = desc2res, desc3 = desc3res };
t.Add(l);
TipsList.ItemsSource = t;
}
示例11: LoadChartContents
private async void LoadChartContents()
{
bool dbExist = await CheckDbAsync("ouzen.db3");
if (!dbExist)
{
await CreateDatabaseAsync();
}
// Get personnes
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("ouzen.db3");
var query = conn.Table<ouzen>();
ouzen = await query.ToListAsync();
for (int i = 0; i < ouzen.Count; i++) Debug.WriteLine(ouzen[i].date1);
// items.Add(new ouzen { Name =q , Value = _random.Next(35, 150) });
((LineSeries)this.LineChart.Series[0]).ItemsSource = ouzen;
((LineSeries)this.LineChart.Series[0]).DependentRangeAxis =
new LinearAxis
{
Minimum = 35,
Maximum = 150,
Orientation = AxisOrientation.Y,
Interval = 5,
ShowGridLines = true
};
((LineSeries)this.LineChart.Series[0]).Refresh();
}
示例12: LoadTrack
public async Task<TrackItem> LoadTrack(int trackId)
{
var connection = new SQLiteAsyncConnection(DbPath);
var query = connection.Table<TrackItem>().Where(x => x.Id.Equals(trackId));
var result = await query.ToListAsync();
return result.FirstOrDefault();
}
示例13: GetFromPath
public async Task<VideoItem> GetFromPath(String path)
{
var conn = new SQLiteAsyncConnection(DbPath);
var req = conn.Table<VideoItem>().Where(x => x.Path == path);
var res = await req.ToListAsync().ConfigureAwait(false);
return res.FirstOrDefault();
}
示例14: LoadTrack
async Task<MusicLibraryViewModel.TrackItem> LoadTrack(int artistId, int albumId, string trackName)
{
var connection = new SQLiteAsyncConnection(_dbPath);
var query = connection.Table<MusicLibraryViewModel.TrackItem>().Where(x => x.Name.Equals(trackName)).Where(x => x.ArtistId == artistId).Where(x => x.AlbumId == albumId);
var result = await query.ToListAsync();
return result.FirstOrDefault();
}
示例15: CounterSubscribed
public async static Task<int> CounterSubscribed()
{
SQLiteAsyncConnection sqlConnection = new SQLiteAsyncConnection(DbHelper.DB_PATH);
int counters = await sqlConnection.Table<Counter>().CountAsync();
AppStore.AddValue(Constants.CountersSubscribed, counters.ToString());
return counters;
}