Asp.Net cannot insert record to dbf file? Help

N

nick

I have a class library to insert a new record into a dbf file. I always get
exception "Operation must use an updateable query" when the function is
called by a Asp.Net function. However, the insersion works well when I call
the function using NUnit. The following is the writing dbf code. Any clue?
Thanks.

Class DAL

static public function writedbf()
....
Dim dbfConnectionString as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\dbfs;Extended Properties=dBase IV;User ID=Admin;Password="

Dim InsertCmdStr As String = "Insert Into wolog (WOTYPE, REF_NO, PRIORITY,
Unit, DEPT, DEPT_ID, PAC2, RQNAME, RQPHONE, SHOP, ASTO, WODATE, OPTR,
LOCATION, COMM1, ESTHR, STATUS, UP, ROOM, FLR) values
('D','D700804','5','90','740','1','2BUS','a','a','SEC','','11/10/2004
2:02:27 PM','login','2 BUS ST a ','a ',0,'N','N','a','')"

Dim cmd As New OleDbCommand(InsertCmdStr, New
OleDbConnection(dbfConnectionString))

cmd.Connection.Open()
Try
REF_NO = cmd.ExecuteScalar()
Catch err As Exception
Throw err
Finally
If Not cmd.Connection Is Nothing Then
cmd.Connection.Close()
End If
End Try
.....
 
P

Paul Clement

¤ I have a class library to insert a new record into a dbf file. I always get
¤ exception "Operation must use an updateable query" when the function is
¤ called by a Asp.Net function. However, the insersion works well when I call
¤ the function using NUnit. The following is the writing dbf code. Any clue?
¤ Thanks.
¤
¤ Class DAL
¤
¤ static public function writedbf()
¤ ...
¤ Dim dbfConnectionString as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data
¤ Source=C:\dbfs;Extended Properties=dBase IV;User ID=Admin;Password="
¤
¤ Dim InsertCmdStr As String = "Insert Into wolog (WOTYPE, REF_NO, PRIORITY,
¤ Unit, DEPT, DEPT_ID, PAC2, RQNAME, RQPHONE, SHOP, ASTO, WODATE, OPTR,
¤ LOCATION, COMM1, ESTHR, STATUS, UP, ROOM, FLR) values
¤ ('D','D700804','5','90','740','1','2BUS','a','a','SEC','','11/10/2004
¤ 2:02:27 PM','login','2 BUS ST a ','a ',0,'N','N','a','')"
¤
¤ Dim cmd As New OleDbCommand(InsertCmdStr, New
¤ OleDbConnection(dbfConnectionString))
¤
¤ cmd.Connection.Open()
¤ Try
¤ REF_NO = cmd.ExecuteScalar()
¤ Catch err As Exception
¤ Throw err
¤ Finally
¤ If Not cmd.Connection Is Nothing Then
¤ cmd.Connection.Close()
¤ End If
¤ End Try
¤ ....
¤

Please don't start a new thread to a question that is only a day old.

If this is an ASP.NET application then it is likely a permissions problem. I don't know whether you
are using any authentication for your ASP.NET app but the account under which the thread executes
must have read/write access to the folder where the dBase files are located. If your ASP.NET
application is not using impersonation, then the account you need to enable permissions for is
called ASPNET.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
J

Jeff Dillon

Yes, give Everyone Full Control to the dbf directory. This is the same
message one would get with Access with incorrect folder permissions. Also,
for Access anyway, you needed to check for permissions on the TEMP and TMP
directories, but this may have been only for previous versions of MDAC.

Jeff
 
N

nick

If the dbf files are in a Network shared driver, like Novell Netware drive,
how to set the security?
 
N

nick

I am using Netware client and the ASP.Net application got the following
error when the dbf files are stored in a Netware drive.

'G:\SHARED\temp' is not a valid path. Make sure that the path name is
spelled correctly and that you are connected to the server on which the file
resides.
 
N

nick

I think it's still a permission problem. Local ASPNET don't have permission
to access the Netware driver? How to workaround it?
 
P

Paul Clement

¤ I think it's still a permission problem. Local ASPNET don't have permission
¤ to access the Netware driver? How to workaround it?
¤

I'm not familiar enough with Netware to provide guidance with respect to permissions.

Is it possible to access the file with a UNC path instead of a mapped drive? The ASPNET account
probably cannot see the mapped drive.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
G

Guest

What about Guests group? Is it OK?

Jeff Dillon said:
Yes, give Everyone Full Control to the dbf directory. This is the same
message one would get with Access with incorrect folder permissions. Also,
for Access anyway, you needed to check for permissions on the TEMP and TMP
directories, but this may have been only for previous versions of MDAC.

Jeff
 

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