DB Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

SELECT * FROM `user` the_table WHERE the_table.userid = DB Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2

SELECT * FROM `user` the_table WHERE the_table.userid = Converting data types in Java? - iTechForums
Login
Search
Welcome to the iTechForums.
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 4
Members:
Number of Users Online:
Welcome to our newest member,
Reply
 
Thread Tools Display Modes
  #1  
Old 05-15-2008, 02:34 PM
willsi_1989 willsi_1989 is offline
Junior Member
 
Join Date: May 2008
Posts: 2
Default

Converting data types in Java?


I wondered if it is possible to convert a "double" data type into a "integer" data type?

This is simply because I have calculated a formula which is giving me an answer in a "double" data type... and when i output the result I basically just want to knock off the decimal point and give the answer as an integer.

Doing this the way I would do it as a beginner at java just gives me the error, possible loss of precision.

I understand you may not be able to do it this way, and if its so its cool.

would appreciate it if people could give me some help.

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-15-2008, 02:39 PM
blessed_thang blessed_thang is offline
Junior Member
 
Join Date: May 2008
Posts: 20
Default

Get real familiar with the
String.format()
method. Consider...
double dd = 555.5554;
System.out.println( String.format("double to int is: %3.0f", dd));

and the result is: 556 -- as a String

for a real int...
double dd = 555.5554;
int x = Integer.parseInt( String.format("%3.0f", dd) ); // this method uses String

And, what's going on? This is like the C language.
% = entity
3.0 = number of columns, number of decimals
f = a floating point number, either float or double

Because, in hacking we have to jump back and forth between String and a number and back again. String.format() has been the fastest technique I have learned from Java 1.5+.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-15-2008, 02:43 PM
Chad Chad is offline
Junior Member
 
Join Date: May 2008
Posts: 7
Default

you can do this;

(int)(a*b);

where a * b is returning a double.. the (int) will convert it to an integer.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 05-22-2008, 02:58 AM
goleveling goleveling is offline
Member
 
Join Date: May 2008
Posts: 80
Cool

I took the elevator


I took the elevatorSixteen floors above the ground.I thought about my baby wow goldAnd thought I would jump down.I stood there and I hollered!I stood there and I cried!If it hadn't a-been sell wow gold so highI might've jumped and died.
__________________
buycheap wow gold
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Data Types..? Harsh Visual Basic 4 06-09-2008 07:31 PM
java coding, data conversion, mixed mode Arithmetic? saki Java, Java Servlets & JSP 1 05-13-2008 05:04 PM
Any Java API for converting to word document.? mmbaskr Java, Java Servlets & JSP 0 05-12-2008 12:59 AM
what sites are you guys using to check the number and types of shorty Business & Legal Issues 0 05-06-2008 04:40 PM
Set java help (data structures)? take_me_to_ur_leader Java, Java Servlets & JSP 0 05-06-2008 09:33 AM

Your Ad Here

All times are GMT. The time now is 10:55 PM.