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

SQL update statement in VB

Mac
I am trying to update price with cost times 100.

I am getting an error.

I would appreciate if someone please correct my code.

Thx


strcnn = "DRIVER=SQL SERVER; SERVER=" & SQLSVRSTR & ";" & _
"UID=sa;PWD=TEST;DATABASE=" & SQLDBStr & ";"
Set cn = New ADODB.Connection
cn.Open strcnn
mprodcl = prod.txtpclass
markup = 100
strsql = "Update mytable SET mytable.price = " & mytable.cost & "*" & markup
& ""
cn.Execute strsql
Jul 23 '05 #1
2 1678

"Mac" <ma*@hotmail.com> wrote in message news:1X6ee.7511$db7.5870@trnddc01...
I am trying to update price with cost times 100.

I am getting an error.

I would appreciate if someone please correct my code.

Thx


strcnn = "DRIVER=SQL SERVER; SERVER=" & SQLSVRSTR & ";" & _
"UID=sa;PWD=TEST;DATABASE=" & SQLDBStr & ";"
Set cn = New ADODB.Connection
cn.Open strcnn
mprodcl = prod.txtpclass
markup = 100
strsql = "Update mytable SET mytable.price = " & mytable.cost & "*" & markup
& ""
cn.Execute strsql


strsql = "Update mytable SET mytable.price = mytable.cost * " & markup
Jul 23 '05 #2
"Mac" <ma*@hotmail.com> wrote in message
news:1X6ee.7511$db7.5870@trnddc01
I am trying to update price with cost times 100.

I am getting an error.

I would appreciate if someone please correct my code.

Thx


strcnn = "DRIVER=SQL SERVER; SERVER=" & SQLSVRSTR & ";" & _
"UID=sa;PWD=TEST;DATABASE=" & SQLDBStr & ";"
Set cn = New ADODB.Connection
cn.Open strcnn
mprodcl = prod.txtpclass
markup = 100
strsql = "Update mytable SET mytable.price = " & mytable.cost & "*" &
markup & ""
cn.Execute strsql


strsql = "Update mytable SET mytable.price = mytable.cost * " & cstr(markup)

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Jul 23 '05 #3

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

Similar topics

3
by: Mark A Framness | last post by:
Greetings, I am working on a project and we need to write a conversion script to initialize a new field on a table. The number of records on this table is on the order of millions so routine...
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...
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...
8
by: pb648174 | last post by:
I have a single update statement that updates the same column multiple times in the same update statement. Basically i have a column that looks like .1.2.3.4. which are id references that need to...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
1
by: amitbadgi | last post by:
HI i am getting the foll error while conv an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in UPDATE statement. Source Error: Line...
1
by: Grant McLean | last post by:
Hi First a simple question ... I have a table "access_log" that has foreign keys "app_id" and "app_user_id" that reference the "application_type" and "app_user" tables. When I insert into...
6
by: FayeC | last post by:
I really need help figuring this out. i have a db with mostly text fields but 2. The user_id field is an autonumber (key) and the user_newsletter is a number (1 and 0) field meaning 1 yes the ...
19
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without...
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...
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
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:
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.