Trouble writing to Access db

N

Nathan Sokalski

I have an ASP.NET Web Application that writes to an Access database. The
application is able to read from the database with no problem, but it will
not write to it. It is not giving me any errors, but it is also not getting
to the Response.Redirect that comes after the code that saves to the
database. I am not sure what to do next, since I am not recieving any
errors. The connection string in my Web.config is:

<appSettings>
<add key="connectionstring" value="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
SOURCE=C:\webroot\pacentralfcu.com\fpdb\resumes.mdb;"/>
</appSettings>

And the VB.NET code that attempts to write to the Access database is:

Dim myconnection As New
OleDbConnection(System.Configuration.ConfigurationManager.AppSettings("connectionstring"))
Dim cmdsubmit As New OleDbCommand(String.Format("INSERT INTO resumes
(fullname,position,dateuploaded,filename) VALUES('{0}','{1}','{2}','{3}')",
Me.txtName.Text, Me.txtPosition.Text, DateTime.Now().ToShortDateString(),
fn), myconnection)
myconnection.Open()
cmdsubmit.ExecuteNonQuery()
myconnection.Close()


Why is this code not saving to the db? Any help would be appreciated.
Thanks.
 
P

Paul Shapiro

The ASP.Net service account needs modify permissions on the folder
containing the Access database. If it can't create the .ldb file, the
database remains read-only even if the account has write permission to the
database file itself.
 
C

Cor Ligthert[MVP]

Nathan,

Why don't you set the cmdsubmit.ExecuteNonQuery not siple in a Try and Catch
block to see what happens.

(Beside that I would try it first with one field and one value in the Insert
transact code)

Cor
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top