我正在尝试使用JDBC
将销售人员添加到我的数据库,但由于某种原因,我的代码在Java代码中产生了日期格式错误。
CREATE PROCEDURE [dbo].[procAddSalesPeople]
@ID int,
@FirstName varchar(25),
@LastName varchar(25),
@StartDate DATE
AS
BEGIN
INSERT INTO SalesPeople(ID, FirstName, LastName, StartDate)
VALUES (@ID, @FirstName, @Lastname, @StartDate)
END
//Test the addSalesPerson() method
System.out.println("Testing addSalePeople() stored procedure");
SalesPeople sp = new SalesPeople( 7,"Jim", "Ike", Date.valueOf("10-10-1991"));
dbc.addSalesPeople(sp);
以下是错误:
测试addSalePeople()
存储过程
线程中的异常" main" java.lang.IllegalArgumentException位于database.framework.StoredProcedureTester.main(StoredProcedureTester.java:112)的database.framework.StoredProcedureTester.initialize(StoredProcedureTester.java:57)的java.sql.Date.valueOf(未知来源)