  | |  | Is this Proper? | Is this Proper? 2005-05-03 - By Ron Smith
Back This question may have been addressed before, but I'm still unclear as to what 's happening under the hood. I normally use ASP pages to access an MS Access database, but I'd like to switch over to using ASP pages with MySQL. Usually I use the following code to insert a record and then close the table and connection with Access: objRS.AddNew objRS("Name") = name objRS("Address") = address objRS("City") = city objRS("State") = state objRS("Zip") = zip objRS("Phone") = phone objRS.Update objRS.close set objRS="nothing" objConn.close set objConn="nothing" With MySQL, I use the following instead: sql="insert into friends_contact_info.friends (Name, StreetAddress, City, State, ZipCode, PhoneNumber) values ('"&name&"', '"&address&"', '"&city&"', '" &state&"', '"&zip&"', '"&phone&"')" set objRS=objConn.execute(sql) I comment out the following lines when I'm adding records to MySQL tables. At first, I was just commenting out the first two lines, but I would get an error message. The record added to the table would be fine, but I'd get an error. So, I decided to comment out everything to elliminate the error messages. Is this proper or am I leaving the table and connection open? Is there a test for this, after the the 'insert into' statement? 'objRS.close ' set objRS="nothing" 'objConn.close ' set objConn="nothing"
Earn $52 per hosting referral at Lunarpages.
|
|
 |