Insert Quote and Double Quote in DB
-
Hey Guys I have problem inserting single and double quotes in DB How can i insert single Quote and Double Quotes in DB Can You provide me a simple code for that
Regards Ramy
-
Hey Guys I have problem inserting single and double quotes in DB How can i insert single Quote and Double Quotes in DB Can You provide me a simple code for that
Regards Ramy
hi, use this one q = "select * from main where lotnumber like " & """" & ComboBoxlotnumber.Text.Trim & "%" & """" here ComboBoxlotnumber.Text.Trim may contain single & double quotes hope this helps
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)
-
Hey Guys I have problem inserting single and double quotes in DB How can i insert single Quote and Double Quotes in DB Can You provide me a simple code for that
Regards Ramy
Apostrophes inside a string in SQL has to be encoded, and depending on what database you are using, backslashes also. There is nothing special about quotes in a string, so if you have problem with them, there is something else that you are doing wrong. For MySQL: Replace "\" with "\\" and replace "'" with "\'" (in that order). For MSSQL, Access: Replace "'" with "''".
--- single minded; short sighted; long gone;
-
Hey Guys I have problem inserting single and double quotes in DB How can i insert single Quote and Double Quotes in DB Can You provide me a simple code for that
Regards Ramy
Use parameterized queries to store the information in the database and you don't have to worry about escaping the quote marks. SQL Injection Attacks and Some Tips on How to Prevent Them[^]
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007