继续为我的计划

时间:2017-04-28 02:27:26

标签: java mysql sql jdbc

我正在尝试使用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(未知来源)

0 个答案:

没有答案