Java problem inserting a record into Access DB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dav3
    New Member
    • Nov 2006
    • 94

    #16
    Not sure I understand now...

    is that not what lines 5 and 6 of my previous post are doing?

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #17
      Originally posted by dav3
      Not sure I understand now...

      is that not what lines 5 and 6 of my previous post are doing?
      Add this line and see what happens
      [CODE=java]System.out.prin tln(db_statemen t); //add this line
      db_statement.ex ecuteUpdate(sql Record);[/CODE]

      Comment

      • dav3
        New Member
        • Nov 2006
        • 94

        #18
        ok it says its null, but the statement hasnt been created yet? (no?)


        Why the hell is it null?!


        *confused*

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #19
          Originally posted by dav3
          ok it says its null, but the statement hasnt been created yet? (no?)


          Why the hell is it null?!


          *confused*
          Where did you initialize the db_statement variable?
          It often helps to dry run the code and check to make sure that your flow ensures that all variables are properly initialized when they are needed.

          Comment

          • dav3
            New Member
            • Nov 2006
            • 94

            #20
            but why will insertRecord(); work perfectly if i pass it say

            Code:
            dbInstance.insertRecord("01-11-07","89.7");


            Ok through trial and error i stumbled upon a solution. I just need to move my db.Instance.loa dDriver(); etc.... functions up to the readfile();

            I think I see the reason for this, thank you for your help ro35198x. This is only step 4 of a MASSIVE project so rest assured I will be back:)

            Thanks again.
            Last edited by dav3; Sep 27 '07, 10:49 PM. Reason: found the mistake i think...

            Comment

            • r035198x
              MVP
              • Sep 2006
              • 13225

              #21
              Originally posted by dav3
              but why will insertRecord(); work perfectly if i pass it say

              Code:
              dbInstance.insertRecord("01-11-07","89.7");


              Ok through trial and error i stumbled upon a solution. I just need to move my db.Instance.loa dDriver(); etc.... functions up to the readfile();

              I think I see the reason for this, thank you for your help ro35198x. This is only step 4 of a MASSIVE project so rest assured I will be back:)

              Thanks again.
              It's r035198x.

              Comment

              Working...