Tuesday, December 4, 2007

How efficient is the method shown above

How efficient is the method shown above

How efficient is the method shown above

Well, this is not really efficient because you are opening the entire table to the recordset and then finally you add your record in. It can be done but rather unnecessary.

The more efficient way of doing it would be

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

cn.Open "DSN=myDSN;UID=sa;PWD=;DATABASE=pubs"

Set rs = Server.CreateObject("ADODB.Recordset")

Rs.open "INSERT INTO EMPLOYEE(name, position) VALUES (‘Alan’, ‘

Sales Manager’), conn, 1,3

No comments: