Home | Advertising Info79 USERS CURRENTLY ONLINE   
   Site Search Contact Us Thursday, December 18, 2014  
 
 







DISCUSSION ARCHIVES
DISCUSSION ARCHIVES 2
DISCUSSION ARCHIVES 3
BLOG

 
Try a free httpZip trial now and compress for less!


We didn't realize
the site was so popular.

Other Stuff
 
 


Using ADO to update an existing record.


In this example we are using ADO to update an existing record. The SQL statement is the key and by changing that you can update whatever record you want to.

This is just an example to get you started.

<% ID = 7 %>
<% NAME = "Joe Smoe" %>
<% MESSAGE = "This is another test" %>


<%
' declaring variables
' not neccesary but a good habit
Dim DataConn
Dim CmdUpdateRecord
Dim MYSQL
   
Set DataConn = Server.CreateObject("ADODB.Connection")
Set CmdUpdateRecord = Server.CreateObject("ADODB.Recordset")
   
' The line below shows how to use a system DSN instead of a DNS-LESS connection
' DataConn.Open "DSN=System_DSN_Name"
DataConn.Open "DBQ=" & Server.Mappath("../_database/database.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
   
MYSQL = "SELECT some_table.* FROM some_table WHERE (ID = " & ID & ")"
   
CmdUpdateRecord.Open MYSQL, DataConn, 1, 3
   
CmdUpdateRecord.Fields("NAME") = NAME
CmdUpdateRecord.Fields("MESSAGE") = MESSAGE
CmdUpdateRecord.Update
   
' closing objects and setting them to nothing
' not neccesary but a good habit
CmdUpdateRecord.Close
Set CmdUpdateRecord = Nothing
DataConn.Close
Set DataConn = Nothing
%>



 

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright 1998 - 2014 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages asp source code database MS SQL MS Access .mdb adovbs.inc cookies calendar codes sql commands scripts asp programming tutorials iis web server components CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com