Trouble writing to Access db

Discussion in 'ASP .Net' started by Nathan Sokalski, Feb 25, 2009.

  1. 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.
    --
    Nathan Sokalski

    http://www.nathansokalski.com/
    Nathan Sokalski, Feb 25, 2009
    #1
    1. Advertising

  2. Nathan Sokalski

    Paul Shapiro Guest

    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 Sokalski" <> wrote in message
    news:...
    >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.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
    Paul Shapiro, Feb 25, 2009
    #2
    1. Advertising

  3. 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

    "Nathan Sokalski" <> wrote in message
    news:...
    >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.
    > --
    > Nathan Sokalski
    >
    > http://www.nathansokalski.com/
    >
    Cor Ligthert[MVP], Feb 26, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hypo
    Replies:
    6
    Views:
    392
  2. Eric Johannsen

    Trouble writing to EventLog

    Eric Johannsen, Aug 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    346
    Eric Johannsen
    Aug 10, 2003
  3. Jens Mittag
    Replies:
    4
    Views:
    603
    Dave Thompson
    Jun 17, 2004
  4. Replies:
    17
    Views:
    521
    Peter Otten
    Dec 1, 2006
  5. Arne
    Replies:
    13
    Views:
    441
    member thudfoo
    Jan 24, 2008
Loading...

Share This Page