Re: Inserting a String containg quotation character.
here is my sub code.
Private Sub cmdadd_Click()
Dim objpv As PV.encrypter
Dim mykey As String
Dim incrpass As String
Dim incruser As String
Dim incrkey As String
Dim sql As String
Dim con As New ADODB.Connection
If txtusername.Text = "" Or txtpassword = "" Or txtkey.Text = "" Then
MsgBox "Please fill-up all the fields!", vbInformation, "Igen Access"
Else
Set objpv = CreateObject("pv.encrypter")
mykey = objpv.Setkey("pvigen")
incruser = objpv.Encryptme(txtusername.Text)
incruser = Replace(CStr(incruser), "'", "''")
incruser = Replace(CStr(incruser), Chr(34), """")
incrpass = objpv.Encryptme(txtpassword.Text)
incrpass = Replace(CStr(incrpass), "'", "''")
incrpass = Replace(CStr(incrpass), Chr(34), """")
incrkey = objpv.Encryptme(txtkey.Text)
incrkey = Replace(CStr(incrkey), "'", "''")
incrkey = Replace(CStr(incrkey), Chr(34), """")
sql = "Insert Into access values('" & incruser & "','" & incrpass & "','" & incrkey & "')"
con.Open "igen"
con.Execute sql
con.Close
Set con = Nothing
Set objpv = Nothing
MsgBox "New access data added!", vbInformation
End If
End Sub