Tuesday, December 4, 2007

How do you update or modify your data

How do you update or modify your data

Update or modify your data

In order to update your data you can use the following code that utilize the Execute method.

<%

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

conn.Open "DSN=MyDSN"

' Insert a record

conn.Execute("INSERT INTO MyTable(Field1,Field2) VALUES (Value1,

Value2))

' Update a record

conn.Execute("UPDATE MyTable SET Field1 = Value1 WHERE Field1 = Value2")

conn.Close %>

Note that the modification is achieved through the use of SQL statement, which is more efficient.

No comments: