Inserting text in an Access DB Validation Rule problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • adsdldsfasd
    New Member
    • Feb 2008
    • 1

    Inserting text in an Access DB Validation Rule problem

    Hi guys.



    I have an Access DB that has a Course table with a primery key CourseSignature which has a validation rule

    Like "[A-Z][A-Z][A-Z][A-Z]###". For example CSCB343. When I try to enter a value in the DB with



    OleDbCommand insertCommand = new OleDbCommand();

    insertCommand.C ommandText = "INSERT INTO Course(CourseSi gnature, CourseName, Credits) VALUES('" + signature + "', '" + name + "', " + credits + ")";

    insertCommand.C onnection = conn.getOleConn ();

    insertCommand.E xecuteNonQuery( );



    it gives me an exception that the CourseSignuter is not in the format Like "[A-Z][A-Z][A-Z][A-Z]###". Why!!?!
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Originally posted by adsdldsfasd
    Hi guys.



    I have an Access DB that has a Course table with a primery key CourseSignature which has a validation rule

    Like "[A-Z][A-Z][A-Z][A-Z]###". For example CSCB343. When I try to enter a value in the DB with



    OleDbCommand insertCommand = new OleDbCommand();

    insertCommand.C ommandText = "INSERT INTO Course(CourseSi gnature, CourseName, Credits) VALUES('" + signature + "', '" + name + "', " + credits + ")";

    insertCommand.C onnection = conn.getOleConn ();

    insertCommand.E xecuteNonQuery( );



    it gives me an exception that the CourseSignuter is not in the format Like "[A-Z][A-Z][A-Z][A-Z]###". Why!!?!
    I thought numbers were [0-9] and # used for comments. HTH.

    Comment

    Working...