Updating records?

Updating records?

am 28.05.2005 23:37:59 von Jon

Using the follow format (or similar) for accessing data from a database and
any other required operations. How would I go about an update query? I'm
aware it's a case of setting sSQL to "Update [Table] SET" etc but what
constants should use and where?

myDSN="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Program Files\Apache Group\Apache2\htdocs\ADO\users.mdb"

set CN=server.createobject("ADODB.Connection")
CN.Open myDSN

sSQL =

set cmd=Server.Createobject("ADODB.command")
with cmd
.CommandText=sSQL
.CommandType=
Set .ActiveConnection=CN
on error resume next
.Execute ,array
end with

CN.close

Thanks,

--
Jon
warpedpixel@gmail.com
Look at that dead pixel on your screen! *SLAP* Gotcha!

Re: Updating records?

am 07.06.2005 14:13:17 von josephweiss

Here you go...

SQL = "SELECT ID,name,email FROM [your Table] WHERE
ID="&request.form("ID")&""
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorType = 2
rs.LockType = 3
rs.Open MySQL, CN
rs.fields("name") = request.form("name")
rs.fields("email") = request.form("email")
rs.Update
rs.Close
Set rs = Nothing

CN.close
set CN = nothing