problem in updating field in dbase IV database

Results 1 to 2 of 2

Thread: problem in updating field in dbase IV database

  1. #1
    Join Date
    Dec 1969

    Default problem in updating field in dbase IV database

    i have a dBase IV database. every time a record is accessed, i want to update a counter field "hc". the script is given below.<BR>------------------------------------------------------------------<BR><BR>dim classdbf,studentname<BR>classdbf="c_2a"<BR><BR>stu dentname="RUPESH PRADHAN"<BR><BR>Dim oConn, sConnString<BR>Set oConn = Server.CreateObject("ADODB.Connection")<BR>sConnSt ring = "DRIVER={Microsoft dBase Driver (*.dbf)};" & _ <BR>"DBQ=" & Server.MapPath("databasehyearly") & ";"<BR><BR>oConn.Open(sConnString)<BR><BR>&#039;sq l to get marks of the student<BR>sql="select * from "&classdbf&" where nm=&#039;"& studentname &"&#039;"<BR><BR>Set rs = oConn.Execute(sql)<BR><BR><BR>response.write(rs("h c"))<BR>newHc=rs("hc")+1<BR>rs("hc")=newHc<BR>rs.u pdate<BR>response.write(rs("hc"))<BR><BR>oConn.clo se<BR>response.end<BR><BR>-----------------------------------------<BR>the error is as follows :<BR><BR>ADODB.Recordset error &#039;800a0cb3&#039; <BR><BR>Object or provider is not capable of performing requested operation. <BR><BR>/rva/t.asp, line 21 <BR><BR>----------------------------------------<BR><BR>i also tried to close the recordset connection opened above and opened another one and tried to execute the following sql statement :<BR><BR>sql2Update="UPDATE " &classdbf& " set"&_<BR>" hc="&"&#039;"&newHc&"&#039;"&_<BR>" where nm="&"&#039;"&studentname&"&#039;"<BR><BR>With the above sql statement i get the following error : <BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80004005&#039; <BR><BR>[Microsoft][ODBC dBase Driver] Operation must use an updateable query. <BR><BR>/rva/t.asp, line 24 <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: problem in updating field in dbase IV database

    When you use Set RS = MyConn.Execute you get a read-only recordset. You have to use RS.Open and supply the correct cursor.<BR><BR>Check, they have a good article on choosing the correct cursor.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts