being frustrated of execNonQuery working fine in WinForm, but NOT WebForm

  • Thread starter Thread starter Rabbit
  • Start date Start date
R

Rabbit

I just couldn't figure out this strange behaviour, can anyone tell me why
the following data access code can be executed in Windows form, but it
causes error when using them in Web Form:


Private Sub btn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn.Click

Dim Connstr As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Password='';User ID=Admin;Data
Source=C:\Data.mdb"
Dim cn As New OleDbConnection(Connstr)
Dim strSQL As String = "Update tbl_User Set UserPwd = 'test123'"
Dim cmd As OleDbCommand = New OleDbCommand(strSQL, cn)
cn.Open()
Dim intRec As Integer = cmd.ExecuteNonQuery() '<======= this is
the line generating the error msg
Console.WriteLine(intRec)

End Sub

The error message saying "Operation must use an updateable query"
 
I found that if I use the same code running on my PC, the code works fine
for both WinForm and WebForm, is this because this problem is due to some
kind of web component installation problem?
 
oop! I meant if the code running on another PC!! it works fine for both
Winform and Webform. Does anyone have any idea!
 
Got it! I found the answer from knowledge base, its because my Internet
Guess Account don't have access right to update Access Database file, only
Web Form uses Internet Guess Account to access the file, win form will use
current login account, thats why I have such problem only in Web Form.

I noted this case will apply on NTFS file format only, there is no file
level access right checking for web form access!
 
Back
Top