.net and microsoft access database need urgent help

Discussion in 'Programming' started by rahuldas14, Apr 12, 2011.

  1. #1
    Am using oledb to connect and use access database. it is connecting and reading too. But I cant add new data to the database. help me.
     
    rahuldas14, Apr 12, 2011 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Does the user you are using have write permission?
     
    AstarothSolutions, Apr 12, 2011 IP
  3. rahuldas14

    rahuldas14 Well-Known Member

    Messages:
    679
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    130
    #3
    I am using the default user. I havent used any custom made username or password.
     
    rahuldas14, Apr 12, 2011 IP
  4. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What is your code looking like? What error are you getting?
     
    AstarothSolutions, Apr 12, 2011 IP
  5. rahuldas14

    rahuldas14 Well-Known Member

    Messages:
    679
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    130
    #5
    I get this error:

    Syntax error in INSERT INTO statement.

    The code is:

     
    rahuldas14, Apr 12, 2011 IP
  6. brian65

    brian65 Active Member

    Messages:
    1,172
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    88
    #6
    Although it doesn't explain the failure to add, one problem with your code is that in the addNew method you are calling conn.Close() after the commit() method has disposed of the connection.
     
    brian65, Apr 13, 2011 IP