Fix issue with ' symbol in SQLite

This commit is contained in:
JackCarterSmith 2017-06-19 11:56:44 +02:00
parent 57fe42308d
commit 890957a0a0
2 changed files with 3 additions and 3 deletions

View File

@ -33,7 +33,7 @@ Public Class AddMachine
Using con As New SQLiteConnection("URI=file:db.sqlite")
con.Open()
Dim cmd As New SQLiteCommand(con)
cmd.CommandText = "INSERT INTO computers_desc VALUES ('" & NewIDBox.Text & "','" & NewNameBox.Text & "'," & NewEtatBox.SelectedIndex & "," & CheckToNumeric(NewSerieCheckBox) & ",'" & NewDetailsBox.Text & "',0,'N/A','" & NewGivenByBox.Text & "');"
cmd.CommandText = "INSERT INTO computers_desc VALUES ('" & NewIDBox.Text & "','" & NewNameBox.Text & "'," & NewEtatBox.SelectedIndex & "," & CheckToNumeric(NewSerieCheckBox) & ",'" & Replace(NewDetailsBox.Text, "'", "_*_") & "',0,'N/A','" & NewGivenByBox.Text & "');"
If cmd.ExecuteNonQuery() <> 1 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End
cmd.CommandText = "INSERT INTO computers_progress VALUES ('" & NewIDBox.Text & "',0,0,0,0,0,1,1,1);"
If cmd.ExecuteNonQuery() <> 1 Then MsgBox("Erreur inconnue au niveau de la base de données !", 16, "Defaillance générale !") : End

View File

@ -206,7 +206,7 @@ Public Class Main
EtatBox.Text = "Neuf"
End If
SerieCheckBox.Checked = dtr.GetBoolean(3)
DetailsBox.Text = dtr.GetString(4)
DetailsBox.Text = Replace(dtr.GetString(4), "_*_", "'")
EmpruntCheckBox.Checked = dtr.GetBoolean(5)
EmprunterName.Text = dtr.GetString(6)
GivenByBox.Text = dtr.GetString(7)
@ -275,7 +275,7 @@ Public Class Main
EtatBox.Text = "Neuf"
End If
SerieCheckBox.Checked = dtr.GetBoolean(3)
DetailsBox.Text = dtr.GetString(4)
DetailsBox.Text = Replace(dtr.GetString(4), "_*_", "'")
EmpruntCheckBox.Checked = dtr.GetBoolean(5)
EmprunterName.Text = dtr.GetString(6)
GivenByBox.Text = dtr.GetString(7)