473,795 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL UPDATE cant use characters for update the table column?

15 New Member
query = "UPDATE Camera SET CameraName=" + CameraName + " WHERE CameraName=" + oldIPCamera.Cam eraName;

hi guys! can help me solve this problem? why i cant update the new camera name (camera_3) for replace the old camera name (camera_7)? there is an error "invalid column name camera_7" or is there have any others method to do this? thanks!
Mar 5 '08 #1
5 2517
amitpatel66
2,367 Recognized Expert Top Contributor
query = "UPDATE Camera SET CameraName=" + CameraName + " WHERE CameraName=" + oldIPCamera.Cam eraName;

hi guys! can help me solve this problem? why i cant update the new camera name (camera_3) for replace the old camera name (camera_7)? there is an error "invalid column name camera_7" or is there have any others method to do this? thanks!
What is this value oldIPCamera.Cam eraName?
Is it a column from a table oldIPCamera or its a variable createed in your source code??
Mar 5 '08 #2
lazzypink
15 New Member
What is this value oldIPCamera.Cam eraName?
Is it a column from a table oldIPCamera or its a variable createed in your source code??
oldIPCamera.Cam eraName is a variable created in my source code. do u have any idea?...thanks!
Mar 5 '08 #3
amitpatel66
2,367 Recognized Expert Top Contributor
oldIPCamera.Cam eraName is a variable created in my source code. do u have any idea?...thanks!
The problem in your update statement is that you are not enclosing the values camera_7 and the other one in a single quotes. Try something like this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. query = "UPDATE Camera SET CameraName= '" + CameraName + "' WHERE CameraName='" + oldIPCamera.CameraName + "'";
  3.  
  4.  
Mar 5 '08 #4
lazzypink
15 New Member
The problem in your update statement is that you are not enclosing the values camera_7 and the other one in a single quotes. Try something like this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. query = "UPDATE Camera SET CameraName= '" + CameraName + "' WHERE CameraName='" + oldIPCamera.CameraName + "'";
  3.  
  4.  
Yup! you are correct, i got what i want. thanks pal..
Mar 6 '08 #5
amitpatel66
2,367 Recognized Expert Top Contributor
Yup! you are correct, i got what i want. thanks pal..
You are welcome. Do post back in case of any further issues
Mar 6 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
248484
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a particular surname in a particular town. I can select the records fine with this syntax (testing in Oracle SQL* Plus) SELECT NAMEINFO.LASTNAME, NAMEINFO.FIRSTNAME, NAMEINFO.MIDDLENAME, NAMEINFO.GENDER, ADDRESSINFO.REGION FROM NAMEINFO, ADDRESSINFO...
4
5312
by: Rustam Bogubaev | last post by:
Hi, I have a table with the following columns: ID INTEGEDR, Name VARCHAR(32), Surname VARCHAR(32), GroupID INTEGER, SubGroupOneID INTEGER, SubGroupTwoID INTEGER
8
89321
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON tblMyTable.UniqueID = tblMyTableTEMP.UniqueID SET tblMyTable.myField = tblMyTableTEMP.myField, tblMyTable.myField2 = tblMyTableTEMP.myField2,
1
1254
by: Jeffrey Sheldon via SQLMonster.com | last post by:
I need to copy data from one column that has a max size of 45 characters to a column that has a max size of 20 characters. What is the syntax to say fill the first 20 characters out of 45 from column 1 into column 2? jeff -- Message posted via http://www.sqlmonster.com
18
5987
by: Bill Smith | last post by:
The initial row is inserted with the colPartNum column containing a valid LIKE pattern, such as (without the single quotes) 'AB%DE'. I want to update the column value with the results of a query against a different table (that uses the LIKE predicate) but cannot get around the SQL0132 error . I have tried the hex notation after the LIKE such as (without the quotes)... " where colNewPartNum like ( X'27' || nnn.colPartNum || X'27) " ,...
2
12546
by: shorti | last post by:
Hello again. I previously inquired about updating 1000 records at a time in a script (not using cursors). Now I have to take it one step further. I want to update records from two different records at once. I have half of the step done but cant seem to fit the seconds part in anywhere: db2 "update (select * from EMPLOY where NAME IN (select NAME from ACCOUNT where IDSTATUS <-1 fetch first 1000 rows only)) set WORKIN='N',...
2
7729
by: mokazawa1 | last post by:
Hi, I'm using stored procedures in DB2 UDB 8.1.2. In this stored, I execute a select for update command, opening a cursor. Then I update the rows using fetch and current of. The problem is that I want to return the rows for my Java application. But if I set the cursor of the select for WITH RETURN, I get the values, but I cant execute the update. If I dont use WITH return, I execute the update, but I cant get the result set. Any ideas.
3
3968
by: Michel Esber | last post by:
Hi all, DB2 V8 LUW FP 15 There is a table T (ID varchar (24), ABC timestamp). ID is PK. Our application needs to frequently update T with a new value for ABC. update T set ABC=? where ID = ?
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10437
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10001
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9042
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.