 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 10th, 2003, 11:16 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi, text box ques...
hi, i use a text box to let user type in something and then insert the text to database, but i found that if the user type ' in the text box, example " he's ", it will show the error when inserting to database.
it cause the insert string to have extra '..... i wonder if there is anyway to solve, or user is not allowed to use ' in text box... thanks
best regards
Life's Ng
|
|

September 11th, 2003, 12:25 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
can u send ur CommandString?
Always:),
Hovik Melkomian.
|
|

September 11th, 2003, 01:30 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
DIM Mysql as String= "INSERT INTO CFBReport (InfestLevel, AddRemarks, DbShow) VALUES ( '"& DdlLvl.SelectedItem.Text &"','"& tbRemark.Text &"' , '"& dbtxt &"')"
dim objCmd as New OleDbCommand (Mysql, Conn)
Conn.Open()
objCmd.ExecuteNonQuery()
Conn.Close()
it'll show me this error
Exception Details: System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression ''hi's' , 'OnShow')'.
|
|

September 11th, 2003, 01:39 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
first I think the way u r going is not good! & let me to suggest u something! NEVER use ur Command in that way! set Parameters for ur Command & then set the parameters. This way have better performance & Clear code. Anyway make a commandText with some parametrs u need & then set them. u can also use SP & its better.
HTH.
Always:),
Hovik Melkomian.
|
|

September 11th, 2003, 02:19 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
now i c... thanks Melvik!
|
|

September 11th, 2003, 08:38 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi Melvik, im using this command to solve this problem
tbTextBox.Text= tbTextBox.Text.Replace("'" , "''")
it works nicely!
best regards
Life's Ng
|
|

September 11th, 2003, 08:54 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sorry, its (" ' " , " ' ' ")
|
|

September 11th, 2003, 08:56 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi melvik, can u send me ur email address? there is something i wish to ask personally. thanks.
best regards
life's Ng
|
|

September 13th, 2003, 02:26 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
|
|
|
|
 |