Why PreparedStatement.setBigDecimal(#,new BigDecimal(1000.00)) can't execute?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   dell_yan
Posted On:   Wednesday, March 21, 2001 07:38 PM

I wrote a jdbc program as bellow: ... PreparedStatement st = conn.prepareStatement("insert into bank(userName,pwd,credit,creditLevel) values('?','?',?,?)"); st.setString(1,"dell"); st.setString(2,"dell"); st.setBigDecimal(3,new BigDecimal(1000.00)); st.setBigDecimal(4,new BigDecimal(1000.00)); st.executeUpdate(); ..... but the console prompt : java.sql.SQLException: [TDS Driver]Parameter index out of range:3 ... I changed another jdbc driver,but it was failed,too and it output the type match error infomation. I am sure that the data type in row 3,4 are decimal type. But why it was failed?    More>>

I wrote a jdbc program as bellow:
...
PreparedStatement st = conn.prepareStatement("insert into bank(userName,pwd,credit,creditLevel) values('?','?',?,?)");
st.setString(1,"dell");
st.setString(2,"dell");
st.setBigDecimal(3,new BigDecimal(1000.00));
st.setBigDecimal(4,new BigDecimal(1000.00));
st.executeUpdate();
.....
but the console prompt :
java.sql.SQLException: [TDS Driver]Parameter index out of range:3
...
I changed another jdbc driver,but it was failed,too and it output the type match error infomation.
I am sure that the data type in row 3,4 are decimal type.
But why it was failed?

   <<Less
About | Sitemap | Contact