470,613 Members | 2,198 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,613 developers. It's quick & easy.

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 1639

"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mark A Framness | last post: by
7 posts views Thread by Dave | last post: by
8 posts views Thread by Lauren Quantrell | last post: by
2 posts views Thread by Mike Leahy | last post: by
1 post views Thread by amitbadgi | last post: by
3 posts views Thread by Michel Esber | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.