I've a website in vb.net. While running the website i get the following error:
"Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype."
My DB connection.inc file looks as follows:
Dim strDataSource As String
Dim cnnCRM As ADODB.Connection
I've tried giving the record set object all the properties it required. Still the same error. Can anybody tell me how i can get rid of this error?.....
DB has full permissions. This error happened when i called a function.My code is shown below:
<%=(funcGetMaxDate(rstAWCList.Fields("TOMONTH").Value, rstAWCList.Fields("TOYEAR").Value) & "/" & IIF(IsDBNull(rstAWCList.Fields.Item("TOMONTH").Value), Nothing, rstAWCList.Fields.Item("TOMONTH").Value) & "/" & IIF(IsDBNull(rstAWCList.Fields.Item("TOYEAR").Value), Nothing, rstAWCList.Fields.Item("TOYEAR").Value))%>
The definiton works perfectly. The function definition is as follows:
Function funcGetMaxDate(ByRef prmMonth As String, ByRef prmYear As String) As String Dim intPrmMonth As Integer intPrmMonth =prmMonth Dim iDate As String
Select Case intPrmMonth
Case 1
iDate = 31
Case 2
iDate = CheckMaxDateFebruary(prmYear)
Case 3
iDate = 31
Case 4
iDate = 30
Case 5
iDate = 31
Case 6
iDate = 30
Case 7
iDate = 31
Case 8
iDate = 31
Case 9
iDate = 30
Case 10
iDate = 31
Case 11
iDate = 30
Case 12
iDate = 31
Case Else
iDate = 0
End Select
funcGetMaxDate开发者_Python百科 = iDate
End Function
When the ctrl reaches back the calling function this exception occurs.....
It really looks like you need to specify cursor information such as adOpenDynamic
or adOpenStatic
as well as lock information such as adLockOptimistic
RS.Open(..., Con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
Also, you'll find that most people in the .Net world have moved away from ADODB and use either the native SqlClient or native OLEDB providers.
Does the user that the website is running as have permission to modify that MDB file? If the database is either read-only or only has NTFS read permissions, it's possible that it may report this error.
精彩评论