Monday, December 17, 2007

How to edit a record in the table (Using SQL command)

How to edit a record in the table (Using SQL command)

S T E P - 1

- We need to create a Connection:

<%

Dim oConn

Set oConn = Server.CreateObject("ADODB.Connection")

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")

%>

S T E P - 2

- Use .Execute method to perform the SQL command:

<%

Dim strSQL

strSQL = "UPDATE member SET " & _

"'Email='" & Request.Form("Email") & _

"', Gender='" & Request.Form("Gender") & _

"', AccessLevel='" & Request.Form("AccessLevel") & _

"' WHERE MemberID='" & Request.Form("MemberID") & "';"

oConn.Execute strSQL

oConn.Close

Set oConn = Nothing

%>

No comments: