Trouble writing to Access db

  • Thread starter Thread starter Nathan Sokalski
  • Start date Start date
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.
 
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.
 
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
 
Back
Top