473,366 Members | 1,237 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,366 software developers and data experts.

SQL UPDATE cant use characters for update the table column?

query = "UPDATE Camera SET CameraName=" + CameraName + " WHERE CameraName=" + oldIPCamera.CameraName;

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 2496
amitpatel66
2,367 Expert 2GB
query = "UPDATE Camera SET CameraName=" + CameraName + " WHERE CameraName=" + oldIPCamera.CameraName;

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.CameraName?
Is it a column from a table oldIPCamera or its a variable createed in your source code??
Mar 5 '08 #2
What is this value oldIPCamera.CameraName?
Is it a column from a table oldIPCamera or its a variable createed in your source code??
oldIPCamera.CameraName is a variable created in my source code. do u have any idea?...thanks!
Mar 5 '08 #3
amitpatel66
2,367 Expert 2GB
oldIPCamera.CameraName 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
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 Expert 2GB
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
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...
4
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...
8
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...
1
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...
18
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...
2
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...
2
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...
3
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.