INSERT new record or REPLACE existing record if the primary key already exists


	Command1 = new System.Data.SQLite.SQLiteCommand(Connection1);
	Command1.CommandText = @"INSERT OR REPLACE INTO tblBookCards
								(CardId, CardPicture)
							VALUES
								(@CardId, @CardPicture)";
	Command1.Parameters.AddWithValue("@CardId", CardId);

	if (BookCardImage.Length > 0)
		Command1.Parameters.AddWithValue("@CardPicture", BookCardImage);
	else
		Command1.Parameters.AddWithValue("@CardPicture", DBNull.Value);

 

 

Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *