Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : ASP : ADO/ODBC : Switch to Connection Object Update after using Recordset Object Signup · Login
Author Thread
Switch to Connection Object Update after using Recordset Object
Posted in tutorial: Updating records in the database with ASP
·  TSNJJWW
User
Joined: 7 Mar 2006
Total Posts: 1
Switch to Connection Object Update after using Recordset Object
Posted: 7 Mar 2006
Faisal:
I love the simplicity of your examples! The following is a small part of my application.

Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\A_MOD6032\WebEdits.mdb"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "WEBEDITS"
Adodc1.Recordset.Sort = "NJMMIS_Edit_Id"

Public Sub Process_ALL_WPC()
'now we need to use the connection object or even work with
'the Recordset to perform an SQL update of remark
' description on all rows having a match to the input remark code
Dim varCurr_Remark
Dim varPrev_Remark
Dim varRemark_Description
Open "C:\PrintRMK.txt" For Output As #2
Open "C:\WPCREMRK.txt" For Input As #1
'--------- runs but only updates one row -------------------------------------------------
Do While Not EOF(1)
Line Input #1, WPC_REMARK_In
varCurr_Remark = Mid$(WPC_REMARK_In, 7, 2)
varRemark_Description = Mid$(WPC_REMARK_In, 10, 200)
Print #2, varCurr_Remark; varRemark_Description
Adodc1.Recordset.Filter = "HEC_Remark_Code = 'M15'"
If (Adodc1.Recordset.BOF = True) Or (Adodc1.Recordset.EOF = True) Then
Else
Adodc1.Recordset("WPC_Remark_Description") = "My UPdate"
Adodc1.Recordset.Update
End If
Loop
If EOF(1) Then
MsgBox "WPCREMRK EOF", vbExclamation, "WPCREMRK"
End If
Close #1
Close #2
Adodc1.Recordset.Close
'Set Adodc1.Recordset = Nothing
End Sub

This DB gets created/updated with other rs code in Subs not shown. It is just this last piece that I need to update all rows that match input data from WPCREMRK file.
Connection object seems the best pathway but I have been unable to build the proper statements to do this.

I prefer to not use any references of any kind when coding statements involving Connection or Recordset information. You assistance is appreciated.

Users Who Have Visited This Thread In Last 24 Hours
5 Visitors

Login
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2009 Stardeveloper.com, All Rights Reserved.