I don't doubt you I'm just trying to learn and understand but.
here's result from your suggestion. (firstname and first value)
Dim SQLAddCus As String
SQLAddCus = "Insert INTO Membership (FirstName, LastName, LastChangeTime, MemberTimeStamp, HowFound, EMailAddress, Zip, ReadTerms, Contribute) "
SQLAddCus &= "Values(" & QM & txtFirstName.Text & QM & "," & QM & txtLastName.Text & QM & "," & QM & Now & QM & "," & QM & Now & QM & "," & QM & ddlHowYouFoundUs.SelectedValue & QM & "," & QM & txtEMail.Text & QM
SQLAddCus &= "," & QM & txtZip.Text & QM & "," & cbReadTerms.Checked & "," & cbContributeToNewsLetter.Checked & ")"
Insert INTO mydb (FirstName, LastName, LastChangeTime, MemberTimeStamp, HowFound, EMailAddress, Zip, ReadTerms, Contribute) Values('a' delelte from mydb','smith','7/25/2007 3:46:17 PM','7/25/2007 3:46:17 PM','Google','Tony@m222.com','10567',True,True)
Which produces an error.
======
here's result from a select which also creates an error
Dim SQL = "Select * from MyDB where FirstName = " & Chr(39) & txtFirstName.Text & Chr(39)
Select * from MyDB where FirstName = 'a' delete from mydb'
thanks
>> Type into the textbox:
>>
[quoted text clipped - 4 lines]
> To the OP, just use SQL Parameters and you'll never have these problems.
> It's recommended by Microsoft anyways.
Spam Catcher - 25 Jul 2007 18:14 GMT
> I don't doubt you I'm just trying to learn and understand but.
>
[quoted text clipped - 26 lines]
>
> Select * from MyDB where FirstName = 'a' delete from mydb'
Try:
If FirstName is: a' delete from mydb;''
http://en.wikipedia.org/wiki/SQL_injection
http://www.securiteam.com/securityreviews/5DP0N1P76E.html
Tony M - 25 Jul 2007 20:08 GMT
Thanks
I tried some examples in the articles.
I see how this can happen now.
I need to learn how to create databases in SQL and not use MS Access anymore
then use the parameters as you suggest.
this input returns all records
a' 't' = 't
Any beginner places to learn how to create database and add fields (columns)
?
Thanks again
>> I don't doubt you I'm just trying to learn and understand but.
>>
[quoted text clipped - 34 lines]
>
> http://www.securiteam.com/securityreviews/5DP0N1P76E.html
Tony M - 25 Jul 2007 23:06 GMT
I found this in case anyone else was interested.
http://www.mikesdotnetting.com/Article.aspx?ArticleID=26
Parameters with MS Access database.
> Thanks
> I tried some examples in the articles.
[quoted text clipped - 47 lines]
>>
>> http://www.securiteam.com/securityreviews/5DP0N1P76E.html