Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET 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
 
Old July 12th, 2006, 01:49 PM
Authorized User
 
Join Date: Feb 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with inserting specific chars in query

Hi ,
i'm using access database with asp.net - and i wrote query that worked excellent - it inserted/updated text in textbox - but when i insert in the text the following character :
'
Then this throws exception - and i understand the reason for it (because the last character closes statement and it gets error) - but i don't know how to solve it . Anybody has some ideas?

 
Old July 16th, 2006, 01:51 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

use this code in Vb.NET
***********************

strSQL = "Insert Into TableName VALUES('" & txt1.Text.Replace("'","''") & "')"

cmd.ExecuteNonQuery(strSQL)

i hope this will ur problem

Ashu

 
Old July 16th, 2006, 01:52 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

Solve*






Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy specific data in specific cells of sheet2 yogeshyl Excel VBA 1 May 14th, 2007 07:40 AM
inserting installments in a query or table fskilnik SQL Language 0 December 14th, 2005 06:15 PM
inserting images in ms sql server using query anal connect2sandep SQL Server 2000 2 July 24th, 2005 04:41 PM
Problem-Specific SQL Query rahulmsccs SQL Language 2 June 17th, 2005 10:18 AM
Create a DLL for inserting a query into jaideep VB Components 1 May 16th, 2005 06:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.