Relearning old ASP/ODBC tricks
Can someone show me the "new way" to do the following (old ASP/ADO code shown) with ASP.NET/ADO.NET? This was opening a table and adding a new row without using any actual SQL SELECT/UPDATE statements. Thanks!
<%
'Get data from Request object
SendTo = Request.Form("PID")
Message = Request.Form("Message")
'Open database connection
Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Open "DSN=dataBaseName;uid=someUid;pwd=xxxx"
'Attach to XMessage table in database
Set rsXMessage = CreateObject("ADODB.Recordset")
rsXMessage.Open "XMessages", dbConn, adOpenKeySet, adLockOptimistic
'Add new row to table
rsXMessage.AddNew
'Set row data
rsXMessage("XTo") = SendTo
rsXMessage("XFromID") = Session("ID")
rsXMessage("XFromName") = Session("Name")
rsXMessage("SentWhen") = Now
rsXMessage("Message") = Message
'Commit/Update changes to row data
rsXMessage.Update
'Close database connection
rsXMessage.Close
%>