473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

apex or apostrofis

Hello fro Italy, is there anyone who can help me here.
This is easy code for inserting data in our company questionnaire. The
problems comes when user inser a data with apostrophis. If he writes
"la casa" it works but if he writes "l'albero" the message gives error
because with apex in the string he can't recognize where the string
ends. How can I solve this problem?
This is code:

Dim cnn1 As New OleDb.OleDbConnection()
Dim str3 As String
'str3 = "insert into DATIQ
(GIUD,RICEV,SERV,QUALCUC,BUFFET,SERRIST,SERSP,MINI ,ANIMD,ANIMS,PRENO,BENES,QP,CONS,TORN,OFFERTE,SUGG ,HOTEL,NPRATICA,DAL,AL,VOLTA,GRAD,NGRAD)
values('" & giud.SelectedItem.Text & "','" & ricev.SelectedItem.Text &
"','" & serv.SelectedItem.Text & "','" & qualcuc.SelectedItem.Text &
"','" & buffet.SelectedItem.Text & "','" & serrist.SelectedItem.Text &
"','" & sersp.SelectedItem.Text & "','" & mini.SelectedItem.Text &
"','" & animd.SelectedItem.Text & "','" & anims.SelectedItem.Text &
"','" & preno.SelectedItem.Text & "','" & benes.SelectedItem.Text &
"','" & qp.SelectedItem.Text & "','" & cons.SelectedItem.Text & "','"
& torn.SelectedItem.Text & "','" & offerte.SelectedItem.Text & "','" &
sugg.Text & "','" & hotel.Text & "','" & npratica.Text & "','" &
dal.Text & "','" & al.Text & "','" & volta.SelectedItem.Text & "','" &
grad.Text & "','" & ngrad.Text & "')"
str3 = "insert into DATIQ
(GIUD,RICEV,SERV,QUALCUC,BUFFET,SERRIST,SERSP,MINI ,ANIMD,ANIMS,PRENO,BENES,QP,CONS,TORN,OFFERTE,sugg ,hotel,NPRATICA,DAL,AL,VOLTA,GRAD,NGRAD)
values('" & giud.SelectedItem.Text & "','" & ricev.SelectedItem.Text &
"','" & serv.SelectedItem.Text & "','" & qualcuc.SelectedItem.Text &
"','" & buffet.SelectedItem.Text & "','" & serrist.SelectedItem.Text &
"','" & sersp.SelectedItem.Text & "','" & mini.SelectedItem.Text &
"','" & animd.SelectedItem.Text & "','" & anims.SelectedItem.Text &
"','" & preno.SelectedItem.Text & "','" & benes.SelectedItem.Text &
"','" & qp.SelectedItem.Text & "','" & cons.SelectedItem.Text & "','"
& torn.SelectedItem.Text & "','" & offerte.SelectedItem.Text & "','" &
sugg.Text & "','" & hotel.Text & "','" & npratica.Text & "','" &
dal.Text & "','" & al.Text & "','" & volta.SelectedItem.Text & "','" &
grad.Text & "','" & ngrad.Text & "')"

RUNSQLSTRING(str3)
Private Sub RUNSQLSTRING(ByVal STR3 As String)
Dim cnn1 As New OleDb.OleDbConnection()
Dim str2 As String
str2 = "File name=c:\aurum.udl"
cnn1.ConnectionString = str2

Dim cmd1 As New OleDb.OleDbCommand()
With cmd1
.Connection = cnn1
.CommandText = STR3
cnn1.Open()
.ExecuteNonQuery()
cnn1.Close()

End With
End Sub
Nov 21 '05 #1
1 1167
use parameters insted of concatenation...

create a command object of type OleDBCommand

then assign each parameter through the user of the parameters collection of
that object... this will fix your problem
"Luca from Italy" <vi***@tin.it> wrote in message
news:42**************************@posting.google.c om...
Hello fro Italy, is there anyone who can help me here.
This is easy code for inserting data in our company questionnaire. The
problems comes when user inser a data with apostrophis. If he writes
"la casa" it works but if he writes "l'albero" the message gives error
because with apex in the string he can't recognize where the string
ends. How can I solve this problem?
This is code:

Dim cnn1 As New OleDb.OleDbConnection()
Dim str3 As String
'str3 = "insert into DATIQ
(GIUD,RICEV,SERV,QUALCUC,BUFFET,SERRIST,SERSP,MINI ,ANIMD,ANIMS,PRENO,BENES,QP,CONS,TORN,OFFERTE,SUGG ,HOTEL,NPRATICA,DAL,AL,VOLTA,GRAD,NGRAD)
values('" & giud.SelectedItem.Text & "','" & ricev.SelectedItem.Text &
"','" & serv.SelectedItem.Text & "','" & qualcuc.SelectedItem.Text &
"','" & buffet.SelectedItem.Text & "','" & serrist.SelectedItem.Text &
"','" & sersp.SelectedItem.Text & "','" & mini.SelectedItem.Text &
"','" & animd.SelectedItem.Text & "','" & anims.SelectedItem.Text &
"','" & preno.SelectedItem.Text & "','" & benes.SelectedItem.Text &
"','" & qp.SelectedItem.Text & "','" & cons.SelectedItem.Text & "','"
& torn.SelectedItem.Text & "','" & offerte.SelectedItem.Text & "','" &
sugg.Text & "','" & hotel.Text & "','" & npratica.Text & "','" &
dal.Text & "','" & al.Text & "','" & volta.SelectedItem.Text & "','" &
grad.Text & "','" & ngrad.Text & "')"
str3 = "insert into DATIQ
(GIUD,RICEV,SERV,QUALCUC,BUFFET,SERRIST,SERSP,MINI ,ANIMD,ANIMS,PRENO,BENES,QP,CONS,TORN,OFFERTE,sugg ,hotel,NPRATICA,DAL,AL,VOLTA,GRAD,NGRAD)
values('" & giud.SelectedItem.Text & "','" & ricev.SelectedItem.Text &
"','" & serv.SelectedItem.Text & "','" & qualcuc.SelectedItem.Text &
"','" & buffet.SelectedItem.Text & "','" & serrist.SelectedItem.Text &
"','" & sersp.SelectedItem.Text & "','" & mini.SelectedItem.Text &
"','" & animd.SelectedItem.Text & "','" & anims.SelectedItem.Text &
"','" & preno.SelectedItem.Text & "','" & benes.SelectedItem.Text &
"','" & qp.SelectedItem.Text & "','" & cons.SelectedItem.Text & "','"
& torn.SelectedItem.Text & "','" & offerte.SelectedItem.Text & "','" &
sugg.Text & "','" & hotel.Text & "','" & npratica.Text & "','" &
dal.Text & "','" & al.Text & "','" & volta.SelectedItem.Text & "','" &
grad.Text & "','" & ngrad.Text & "')"

RUNSQLSTRING(str3)
Private Sub RUNSQLSTRING(ByVal STR3 As String)
Dim cnn1 As New OleDb.OleDbConnection()
Dim str2 As String
str2 = "File name=c:\aurum.udl"
cnn1.ConnectionString = str2

Dim cmd1 As New OleDb.OleDbCommand()
With cmd1
.Connection = cnn1
.CommandText = STR3
cnn1.Open()
.ExecuteNonQuery()
cnn1.Close()

End With
End Sub

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dennis Hore | last post by:
I'm trying to install Nick Patavalis' ppgplot package on Mac OS X 10.3 with python 2.3. I first sent this message to Nick, but he said he doesn't have any experience with the Mac platform. ...
2
by: Todd | last post by:
I am desperately trying to figure out the following problem, simplified for discussion. I have a WinForm with a button, textbox, and datagrid. When I click the button, I want to execute the...
0
by: =?Utf-8?B?U3Vwcml5YQ==?= | last post by:
Oracle has a migration utility that lets you convert an application in Access to Oracle forms. See <http://www.oracle.com/technology/products/database/application_express/...
0
by: prohan | last post by:
Hello: I have an Oracle Forms application that needs to call an Apex application and send it 2 values from the currently displayed Oracle Forms Form. I'm not sure how to do this. I know that I...
2
by: nano2k | last post by:
Hello I accidentaly ran a DELETE command against a table with a wrong WHERE clause. My database had no backup, but the recovery model was Full. I am using SQL Server 2005. Is there a way, or...
5
by: viki1967 | last post by:
Problem with onchange event and apex Hi all. I have problem with this onchange event: onChange="window.document.location='upload.asp?B='+this.options.value;"> If B value contains apex...
1
by: garyb2008 | last post by:
My work now needs to share live data with the companies clients. Its simple stuff - based around one table with a few for aux info - and ive been using Zoho Creator DB but this isnt as solid as we...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.