Update statement (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


Joey -> Update statement (4/24/2008 0:01:06)

I'm doing something wrong here:

I want to add the date where the id = the form field id

myDSN ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../fpdb/test.mdb")

set conntemp=server.createobject("adodb.connection")
conntemp.open myDSN
 
		mySQL = "UPDATE part_tracker SET detail_comp = #" & Date() & "# WHERE ID = ::ID:: "
		conntemp.execute(mySQL)

conntemp.close
set conntemp=nothing


i get this error: Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'ID = ::ID::'.

if i take away the :: it updates all rows




rdouglass -> RE: Update statement (4/24/2008 9:10:27)

quote:

mySQL = "UPDATE part_tracker SET detail_comp = #" & Date() & "# WHERE ID = ::ID:: "


Try this:

mySQL = "UPDATE part_tracker SET detail_comp = #" & Date() & "# WHERE ID = " & Request("ID")

The :: stuff only works inside a DRW and that doesn't look like a DRW. [;)]

That help any?




Joey -> RE: Update statement (4/24/2008 9:33:28)

Perfect, thanks Roger.




Joey -> RE: Update statement (4/24/2008 9:55:09)

now i need one more field updated and am getting an error

mySQL = "UPDATE part_tracker SET detail_comp = #" & Date() & "#, detail_by = " & Request("employee") & " WHERE ID = " & Request("ID") conntemp.execute(mySQL)


I tried several variations and get this error: Syntax error (missing operator) in query expression 'employee1'.




rdouglass -> RE: Update statement (4/24/2008 10:00:32)

quote:

detail_by = " & Request("employee") & "


Is that a text field? If so, it needs apostrophes like so:

...detail_by = '" & Request("employee") & "' ...

See 'em?




Joey -> RE: Update statement (4/24/2008 10:07:16)

Thanks again!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625