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

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"
 
R

Rabbit

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?
 
R

Rabbit

oop! I meant if the code running on another PC!! it works fine for both
Winform and Webform. Does anyone have any idea!
 
R

Rabbit

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top