• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

illegal charactor...(i got it)

 
divid ordo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,i got it. because i used a ideographic space,so ...
thank you all .

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>==
it's not spelling error,in the Productionservlet(servlet) ,i create an object for class Production
just like : Production p=new Production(); int count=p.doInsert(myCon,id);
and method doInsert() in the Production ;
there are some variable like "status","cement_Product"...in Producton.

***************************************************
...
public int doInsert(Connection myCon, int id){
...
sql=" insert into production(status,cement_Product...) values('"+this.status+"','"+this.cement_Production+"'...);
...
int count=mySta.executeUpdate(sql); ....
return count;
}
***************************************************
after javac ,it shows the error:: 'illegal charactor'
in front of the "sql"

ofcourse , constructed function :
public Production(){
this.value=myRes.getInt("status");
this.cement_Production=myRes.getString("cement_Production");
...
****************************************************
and variable's spelling is do right
hello, can anyone give me some advice
thx.

[ January 29, 2005: Message edited by: divid ordo ]
[ January 29, 2005: Message edited by: divid ordo ]
 
Damanjit Kaur
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sql=" insert into production(status,cement_Product...) values('"+this.status+"','"+this.cement_Production+"'...);


Check this statement again for proper placement of " and '.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...or start using a PreparedStatement.
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by divid ordo:
after javac ,it shows the error:: 'illegal charactor'
in front of the "sql"
Since this is a javac error and not a SQLException, I think it's something different. But since you pasted only portions of the method -- specifically you omitted the very spot where the error occurs -- there's no way to tell for sure.

The error is in the "..." right before "sql=..." Do you declare what type sql is? Is the line before it correctly terminated with a semi-colon or does it have some other syntax error?

Try again, and if you can't figure it out, post at least five lines of context around the javac error and the real output from javac, including the error, the line it displays, and the ^ showing where it thinks the error is.

Now, it's possible I misunderstood "after javac it shows the error:: 'illegal charactor' in front of the sql", but if I am and you're getting a SQLException, I don't know how it could possibly know that the variable name is "sql". Again, you're making us guess.

Take a look at the FAQ and How to Ask Questions the Smart Way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic