473,406 Members | 2,451 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,406 software developers and data experts.

Problem on String

my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,
Please help ~

--
..
Nov 21 '05 #1
8 1015
Option Strict On?

Same thing happen with Me.txtEquip.text = "20" ?

What exactly is the exception?
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e1**************@TK2MSFTNGP15.phx.gbl...
my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,
Please help ~

--
.

Nov 21 '05 #2
Option Strict On?

Same thing happen with Me.txtEquip.text = "20" ?

What exactly is the exception?
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e1**************@TK2MSFTNGP15.phx.gbl...
my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,
Please help ~

--
.

Nov 21 '05 #3

"smith" <rc********@smithvoiceTAKEOUT.com> wrote in message
news:kv****************@newsread1.news.pas.earthli nk.net...
Option Strict On?

Same thing happen with Me.txtEquip.text = "20" ?

What exactly is the exception?
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e1**************@TK2MSFTNGP15.phx.gbl...
my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,


Check the database - does it allow non-numeric characters ? How many ?
What type of data is allowed ? Can more than 1 record have the same value
for that field ?

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 11/19/2004
Nov 21 '05 #4

"smith" <rc********@smithvoiceTAKEOUT.com> wrote in message
news:kv****************@newsread1.news.pas.earthli nk.net...
Option Strict On?

Same thing happen with Me.txtEquip.text = "20" ?

What exactly is the exception?
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:e1**************@TK2MSFTNGP15.phx.gbl...
my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,


Check the database - does it allow non-numeric characters ? How many ?
What type of data is allowed ? Can more than 1 record have the same value
for that field ?

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 11/19/2004
Nov 21 '05 #5
"Agnes" <ag***@dynamictech.com.hk> schrieb:
my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,


Think about using '*UpdateCommand' classes with parameters instead of
constructing the SQL command directly. This will prevent SQL injection.
Maybe you can solve your problem by replacing "'" with "''" before inserting
it into the SQL command (if you still want to use the unsecure way of
constructing SQL command strings by hand).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
"Agnes" <ag***@dynamictech.com.hk> schrieb:
my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,


Think about using '*UpdateCommand' classes with parameters instead of
constructing the SQL command directly. This will prevent SQL injection.
Maybe you can solve your problem by replacing "'" with "''" before inserting
it into the SQL command (if you still want to use the unsecure way of
constructing SQL command strings by hand).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #7
Agnes wrote:
my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,
Please help ~


You need to parse your values to replace single quotes with double
quotes. The resulting query you have now looks like this:

update mytable set equipname = ' 20''

That's one quote to many. If Me.txtEqip.text contains 20'' it should
work and enter only one quote into the database. This is especially
important for web applications to prevent SQL injection.

--
Rinze van Huizen
C-Services Holland b.v.
Nov 21 '05 #8
Agnes wrote:
my simple commandtext is ="update mytable set equipname = ' " &
Me.txtEqip.text & " ' " ... where
Now, if Me.txtEqip.text = 20' <-----------I will got the error on this
command,
Please help ~


You need to parse your values to replace single quotes with double
quotes. The resulting query you have now looks like this:

update mytable set equipname = ' 20''

That's one quote to many. If Me.txtEqip.text contains 20'' it should
work and enter only one quote into the database. This is especially
important for web applications to prevent SQL injection.

--
Rinze van Huizen
C-Services Holland b.v.
Nov 21 '05 #9

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

Similar topics

18
by: muser | last post by:
is string converted to its integer equivalent by minusing it by 48? the function is suppose to check the fifth digit of struct member using the formula contained within the function. The function...
7
by: Forecast | last post by:
I run the following code in UNIX compiled by g++ 3.3.2 successfully. : // proj2.cc: returns a dynamic vector and prints out at main~~ : // : #include <iostream> : #include <vector> : : using...
6
by: lenny | last post by:
Hi, I've been trying to use a Sub or Function in VBA to connect to a database, make a query and return the recordset that results from the query. The connection to the database and the query...
18
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
7
by: Ankit Aneja | last post by:
I put the code for url rewrite in my Application_BeginRequest on global.ascx some .aspx pages are in root ,some in folder named admin and some in folder named user aspx pages which are in user...
4
by: David Scemama | last post by:
Hi, I'm trying to read a database file written from a turbo Pascal program. I've set a structure to map the records in the file, but I have problem reading the file when I use VBFixedArray in...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
8
by: Rinaldo | last post by:
Hi, When I start my program in the debugger, there is no problem, but when not I get an exception. It appears in: private void Upload(string filename, string FTnaam) { MessageBox.Show("in...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.