Forum Moderators: open
i have a ms access data base called db.mdb and within that i have a table called tblUsers. this table has some data. eac h row has a column called "Active". this is a checkbox that can be set to yes or no
can anyone plz tell me how i can connect to the database and set the "Active" to "no" where the ID is "414"
thanx
first set up a system DSN for your database db1
<%
Dim up,strSQLup
Set up = Server.CreateObject("ADODB.Connection")
up.ConnectionString = "DSN=YourDSN"
up.Open
Dim RSupdate
Set RSupdate = Server.CreateObject("ADODB.Recordset")
strSQLup = "UPDATE tblUsers SET Active='no' WHERE ID='414';"
RSupdate.Open strSQLup, up
Set RSupdate = Nothing
up.Close
Set up = Nothing
%>
<%
Dim objConn, conn, sql
conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("/database/db.mdb")
set objConn=server.createobject("ADODB.Connection")
objConn.open conn
sql="UPDATE tblUsers SET Active='No' WHERE ID='414'; "
objConn.execute sql
objConn.close
set objConn=Nothing
response.Write "done"
%>
conn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("/database/db.mdb")
set objConn=server.createobject("ADODB.Connection")
objConn.open conn
sql="UPDATE tblUsers SET Active='No' WHERE ID= 414; "
objConn.execute sql
objConn.close
set objConn=Nothing
response.Write "done"
%>
Note the quotes gone from 414. You are inserting a number, not a string.
-Matt
No value given for one or more required parameters.