本文整理汇总了C#中SQLite.SQLiteAsyncConnection.UpdateAsync方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteAsyncConnection.UpdateAsync方法的具体用法?C# SQLiteAsyncConnection.UpdateAsync怎么用?C# SQLiteAsyncConnection.UpdateAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteAsyncConnection
的用法示例。
在下文中一共展示了SQLiteAsyncConnection.UpdateAsync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public Task Update(MapModel map)
{
SQLiteAsyncConnection connection = new SQLiteAsyncConnection(SQLiteConfiguration.ConnectionString);
_dataSources.Remove(_dataSources.First(source => source.ID.Equals(map.ID)));
_dataSources.Add(map);
return connection.UpdateAsync(map);
}
示例2: AddVisit
public async Task<int> AddVisit(Visit visit) {
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(this.dbPath);
if (visit.ID > 0) {
return await conn.UpdateAsync(visit);
}
return await conn.InsertAsync(visit);
}
示例3: 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);
}
}
示例4: btnOK_Click
private async void btnOK_Click(object sender, RoutedEventArgs e)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(Path.Combine(ApplicationData.Current.LocalFolder.Path, "people.db"), true);
//string[] per = new string[10];
var per=App.ViewModel.Items[index];
per.LineFive = watermarkTextBox.Text;
per.Linesix = watermarkTextBox1.Text;
per.Lineseven = watermarkTextBox2.Text;
per.Lineeight = watermarkTextBox3.Text;
Person person = new Person()
{
ID=per.Lineone,
DoctorName=per.Linetwo,
Date=per.Linethree,
Time=per.LineFour,
Temperature=per.LineFive,
Bp=per.Linesix,
symptoms=per.Lineseven,
description=per.Lineeight
};
await conn.UpdateAsync(person);
NavigationService.GoBack();
}
示例5: updateSettings
public static async Task<int> updateSettings(OCSettings settings)
{
settings.id = 1;
String path = ApplicationData.Current.LocalFolder.Path + "/OCTranspo.sqlite";
SQLiteAsyncConnection conn = new SQLiteAsyncConnection(path);
int result = await conn.UpdateAsync(settings);
return result;
}
示例6: Button_Click_5
private async void Button_Click_5(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();
foreach (var item in result)
{
item.Work = "产品经理";
await conn.UpdateAsync(item);
}
}
示例7: RunUpdateTest
async Task RunUpdateTest()
{
var db = new SQLiteAsyncConnection(DatabasePath);
var person = await db.GetAsync<Person>(f => f.FullName.EndsWith("8"));
person.OtherField = "ABCD";
await db.UpdateAsync(person);
var updatedPerson = await db.GetAsync<Person>(f => f.FullName.EndsWith("8"));
var message = updatedPerson.OtherField == "ABCD"
? "Completed!"
: "Did not update person!";
await dispatcher.RunIdleAsync(a => { UpdateResult = message; });
}
示例8: InsertMenu
public async static Task InsertMenu(Menu menu)
{
SQLiteAsyncConnection sqlConnection = new SQLiteAsyncConnection(DbHelper.DB_PATH);
var collectionItem = await sqlConnection.Table<Menu>().Where(x => x.MenuId == menu.MenuId && x.CounterId == menu.CounterId).FirstOrDefaultAsync();
if (collectionItem != null)
{
if (collectionItem.Version < menu.Version)
{
await sqlConnection.UpdateAsync(menu);
}
}
else
{
System.Diagnostics.Debug.WriteLine("Menu Inserted: "+await sqlConnection.InsertAsync(menu));
}
}
示例9: InsertCounter
public async static Task InsertCounter(Counter counter)
{
SQLiteAsyncConnection sqlConnection = new SQLiteAsyncConnection(DbHelper.DB_PATH);
var collectionItem = await sqlConnection.Table<Counter>().Where(x => x.Id == counter.Id).FirstOrDefaultAsync();
if (collectionItem != null)
{
if (collectionItem.MenuVersion != counter.MenuVersion)
{
await sqlConnection.UpdateAsync(counter);
}
}
else
{
await sqlConnection.InsertAsync(counter);
}
await CounterSubscribed();
}
示例10: InsertUpdateDataAsync
public async Task<string> InsertUpdateDataAsync (UserVideo data)
{
try
{
var db = new SQLiteAsyncConnection (_path);
if (await db.InsertAsync (data) != 0)
await db.UpdateAsync (data);
return "Single data file inserted or updated";
}
catch (SQLiteException ex)
{
Log.Error (TAG, ex.Message);
return string.Empty;
}
}
示例11: Update
/// <summary>
/// Update some records
/// </summary>
public async void Update(string sensor)
{
SQLiteAsyncConnection connection = new SQLiteAsyncConnection(textBox.Text);
var SensorQry = await connection.Table<Sensor>().Where(x => x.Name.StartsWith(sensor)).FirstOrDefaultAsync();
if (SensorQry != null)
{
SensorQry.dateTime = DateTime.Now;
SensorQry.Value = GetRandomValue(SensorQry.Name);
await connection.UpdateAsync(SensorQry);
}
}
示例12: sifirla_Click
private async void sifirla_Click(object sender, RoutedEventArgs e)
{
// SayfaID'sinden dualistesinde istenen duayı bul, kacKezOkundu değerini sıfırla
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("duaDB.db");
var sayac = await conn.Table<Dualar>().Where(x => x.Id == sayfaID).FirstOrDefaultAsync();
if (sayac != null)
{
sayac.kacKezOkundu = 0;
await conn.UpdateAsync(sayac);
}
var allusers = await conn.QueryAsync<Dualar>("SELECT kacKezOkundu FROM DuaList WHERE Id = ?",sayfaID);
foreach (var user in allusers)
{
//txtDuaSayaci.Text = user.kacKezOkundu.ToString();
txtDuaSayisi.Text = user.kacKezOkundu.ToString();
}
}
示例13: RemoveFriend_Click
private async void RemoveFriend_Click(object sender, RoutedEventArgs e)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("appData.db");
await conn.CreateTableAsync<User>();
String[] frList1 = currUser.friendsList.Split(',');
String[] frList2 = clickedUser.friendsList.Split(',');
string newList1 = "";
string newList2 = "";
foreach (string s in frList1) if (!s.Equals(clickedUser.Username)) newList1 += (s + ",");
foreach (string s in frList2) if (!s.Equals(currUser.Username)) newList2 += (s + ",");
currUser.friendsList = newList1;
clickedUser.friendsList = newList2;
await conn.UpdateAsync(currUser);
await conn.UpdateAsync(clickedUser);
var msg = new MessageDialog("User removed!");
await msg.ShowAsync();
this.Frame.GoBack();
}
示例14: UpdateDB
public async void UpdateDB(DB data)
{
SQLiteAsyncConnection conn = new SQLiteAsyncConnection("exercice");
await conn.UpdateAsync(data);
}
示例15: insertUpdateData
private async Task<string> insertUpdateData(Person data, string path)
{
try
{
var db = new SQLiteAsyncConnection(path);
if (await db.InsertAsync(data) != 0)
await db.UpdateAsync(data);
return "Single data file inserted or updated";
}
catch (SQLiteException ex)
{
return ex.Message;
}
}