本文整理汇总了C#中SQLite.SQLiteConnection.Update方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.Update方法的具体用法?C# SQLiteConnection.Update怎么用?C# SQLiteConnection.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteConnection
的用法示例。
在下文中一共展示了SQLiteConnection.Update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update(Account currentAccount)
{
using (var connection = new SQLiteConnection(_dbPath))
{
connection.Update(currentAccount);
}
}
示例2: OnSuccess
public void OnSuccess(object response)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
Game game = (Game)response;
string scoreid = game.GetScoreList()[0].GetScoreId();
dbConn = new SQLiteConnection(DB_PATH);
var testdata = dbConn.Query<Task>("select * from task where id='" + 1 + "'").FirstOrDefault();
// Check result is empty or not
if (testdata == null)
MessageBox.Show("id Not Present in DataBase");
else
{
var tp = dbConn.Query<Task>("update task set Scoreid='" + scoreid + "' where Username = '" +testdata.Username + "'").FirstOrDefault();
// Update Database
dbConn.Update(tp);
}
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
});
}
示例3: UpdateLogEntry
public void UpdateLogEntry(LogEntry selectedLogEntry)
{
using (var dbConn = new SQLiteConnection(App.DB_PATH))
{
dbConn.Update(selectedLogEntry);
}
}
示例4: UpdateExercise
public void UpdateExercise(Exercise myExercise)
{
using (var dbConn = new SQLiteConnection(App.DB_PATH))
{
dbConn.Update(myExercise);
}
}
示例5: Results
public Results()
{
InitializeComponent();
App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY);
string gameName;
if ((int)settings["trigger"] == 0)
{
gameName = "Bollywood_game";
}
else
{
gameName = "Hollywood_game";
}
new_xp = Global.findxp(Global.p1Score, Global.p2Score);
dbConn = new SQLiteConnection(DB_PATH);
var tpdata = dbConn.Query<Task>("select * from task where id='" + 1 + "'").FirstOrDefault();
// Check result is empty or not
if (tpdata == null)
MessageBox.Show("Title Not Present in DataBase");
else
{
scoreId = tpdata.ScoreId;
prev_xp = Convert.ToDouble(tpdata.XP);
pres_xp = new_xp + prev_xp;
var tp = dbConn.Query<Task>("update task set XP='" + pres_xp + "' where Username = '" + tpdata.Username + "'").FirstOrDefault();
// Update Database
dbConn.Update(tp);
level = Global.levelFromXP(pres_xp);
switch(level)
{
case 1:
achievementName = "level_1";
break;
case 2:
achievementName = "level_2";
break;
case 3:
achievementName = "level_3";
break;
case 4:
achievementName = "level_4";
break;
}
}
scoreBoardService.SaveUserScore(gameName, Global.localUsername, Global.p1Score, this);
scoreBoardService.EditScoreValueById(scoreId, pres_xp, this);
achievementService.EarnAchievement(Global.localUsername, achievementName, "xp_game", "",this);
}
示例6: UpdateObject
public void UpdateObject(Notes note)
{
using (var db = new SQLiteConnection(dbPath))
{
// var existing = db.Query<Notes>("select * from Notes where id = " + note.ID).FirstOrDefault();
db.RunInTransaction(() => {
db.Update(note);
});
}
}
示例7: Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
using (SQLiteConnection conn = new SQLiteConnection("tempDb.db"))
{
conn.CreateTable(typeof(Person), CreateFlags.None);
//conn.Insert(new Person { Name = "haha1" });
conn.Update(new Person { Name = "haha1" ,Id=12334534 });
System.Diagnostics.Debug.WriteLine(conn.Query<Person>("select * from Person where Name = ? ", "haha1").FirstOrDefault().Id);
}
}
示例8: UpdateGameData
public void UpdateGameData(List<PuzzleGroup> puzzleGroupData, string userName)
{
var serializedPuzzleGroupData = Newtonsoft.Json.JsonConvert.SerializeObject(puzzleGroupData);
var path = GetDatabasePath();
using (var db = new SQLiteConnection(Path.Combine(path, "Puzzle.db")))
{
var puzzGroupData = db.Table<PuzzleGroupGameData>().FirstOrDefault(x => x.GameUserName == userName);
if (puzzGroupData == null) return;
puzzGroupData.Data = serializedPuzzleGroupData;
db.Update(puzzGroupData);
db.Commit();
}
}
示例9: Save
public void Save()
{
SQLiteConnection dbConnection = new SQLiteConnection(new SQLitePlatformWinRT(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "Storage.sqlite"));
if (this.Id == 0)
{
// New
dbConnection.Insert(this);
}
else
{
// Update
dbConnection.Update(this);
}
}
示例10: UpdateTactic
public int UpdateTactic(Tactic tactic)
{
int rs = -1;
using (var db = new SQLiteConnection(this.Path, this.State))
{
var existing = db.Query<Tactic>("SELECT * FROM Tactic WHERE ID=?", tactic.Id).FirstOrDefault();
if (existing != null)
{
existing = tactic.GetCopy();
db.RunInTransaction(() =>
{
rs = db.Update(existing);
});
}
}
return rs;
}
示例11: UpdateContact
//Update existing conatct
public void UpdateContact(Contacts contact)
{
using (var dbConn = new SQLiteConnection(App.DB_PATH))
{
var existingconact = dbConn.Query<Contacts>("select * from Contacts where Id =" + contact.Id).FirstOrDefault();
if (existingconact != null)
{
existingconact.Name = contact.Name;
existingconact.PhoneNumber = contact.PhoneNumber;
existingconact.CreationDate = contact.CreationDate;
dbConn.RunInTransaction(() =>
{
dbConn.Update(existingconact);
});
}
}
}
示例12: UpdateUser
public int UpdateUser(User user)
{
int rs = -1;
using (var db = new SQLiteConnection(this.Path, this.State))
{
var existing = db.Query<User>("SELECT * FROM User WHERE ID=?", user.Id).FirstOrDefault();
if (existing != null)
{
existing = user.GetCopy();
db.RunInTransaction(() =>
{
rs = db.Update(existing);
});
}
}
return rs;
}
示例13: UpdateAccelData
//Update existing conatct
public void UpdateAccelData(AccelData accelData)
{
using (var dbConn = new SQLiteConnection(App.DB_PATH))
{
var existing = dbConn.Query<AccelData>("select * from AccelData where Id =" + accelData.Id).FirstOrDefault();
if (existing != null)
{
existing.X = accelData.X;
existing.Y = accelData.Y;
existing.Z = accelData.Z;
dbConn.RunInTransaction(() =>
{
dbConn.Update(existing);
});
}
}
}
示例14: insertUpdateUser
/// <summary>
/// Speichert oder updatet einen User in der lokalen DB
/// </summary>
/// <param name="data">User</param>
/// <param name="path">SQLite Connection String</param>
/// <returns>0 -> Update</returns>
/// <returns>1 -> Insert</returns>
/// <returns>-1 -> Exception</returns>
public int insertUpdateUser(User data)
{
try
{
var db = new SQLiteConnection(path);
if (db.Insert(data) != 0)
{
db.Update(data);
return 0;
}
return 1;
}
catch (SQLiteException ex)
{
Console.WriteLine(ex.Message);
return -1;
}
}
示例15: SavePassword
public void SavePassword(PasswordItem password)
{
using (SQLiteConnection context = new SQLiteConnection(_connectionString))
{
var existingPassword = (from p in context.Table<PasswordItem>()
where p.Id == password.Id
select p).FirstOrDefault();
if (existingPassword != null)
{
context.Update(password);
}
else
{
context.Insert(password);
}
}
}