Problem with Double type Value in Access Database

Ads

 
 
 

Share on Google+Share on Google+

shweta
Problem with Double type Value in Access Database
1 Answer(s)      7 years ago
Posted in : Java Beginners
Hello sir I have store Double Type Value in MS Access Databse,but when I search Record then it Gives Round Figure Value related with Percentage and
I want to Store and Retrieve Mobile Number with MS access Database,plz Help Me Sir.
Ads
View Answers

April 13, 2010 at 11:36 AM


Hi Friend,

Use rs.getDouble() method to retrieve marks and percentage.

import java.sql.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Test extends JFrame{
public static void main(String[]args){

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con1 =DriverManager.getConnection("jdbc:odbc:access","","");
Statement stmt=con1.createStatement();
double marks=80.58;
double percent=80.58;
int i=stmt.executeUpdate("insert into student1(marks,percentage) values("+marks+","+percent+")");
JOptionPane.showMessageDialog(null,"Data is successfully inserted into database.");
ResultSet rs=stmt.executeQuery("select * from student1 where id=1");
double m=0;
double p=0;
while (rs.next())
{
m=rs.getDouble("marks");
p=rs.getDouble("percentage");
}
System.out.println(m);
System.out.println(p);


}

catch(Exception e){
System.out.println(e);
}
}
}

Thanks

Ads









Related Tutorials/Questions & Answers:
Problem with Double type Value in Access Database - Java Beginners
Problem with Double type Value in Access Database  Hello sir I have store Double Type Value in MS Access Databse,but when I search Record... Mobile Number with MS access Database,plz Help Me Sir.   Hi Friend
code for insert the value from jsp to access database
code for insert the value from jsp to access database  code for insert the value from jsp to access database
Advertisements
how to delete the access database value in jsp
how to delete the access database value in jsp  i loaded my database data into the dropdown list box...now i want to delete the value..plz send the source code to delete the value in dropdown list box and also from database
how to delete the access database value in jsp
how to delete the access database value in jsp  i loaded my database data into the dropdown list box...now i want to delete the value..plz send the source code to delete the value in dropdown list box and also from database
How to Store Float Value into Access Database - Java Beginners
. To store the double value in Access database, you need to set the datatype...How to Store Float Value into Access Database  Hello sir,I want to Store Student Marks Percentage into Access Database in Float Value how i can Store
getting problem in storing & retrieving value in database
getting problem in storing & retrieving value in database  Hello everyone i am doing a project where my back end is ms access & i want to store value like 5353250214 so if i store it as long int in access it wont take it &
Problem with JRadioButton and Access Database - Java Beginners
in Access Databse, I want to store course type in to database and also other fields value . plz help Me. import java.io.*; import java.awt.*; import javax.swing....Problem with JRadioButton and Access Database  Hello sir ,Here I have
Criteria Double Value Compare Example
Criteria Double Value Compare Example In this Example, We will discuss about...;'like' and 'gt'. In This example we compare double data type value in the table. Here is the simple Example code files
how to write to file primitive type double
to file primitive type double in java program? thanks   Hi, To write a file primitive data type double there is a class DataOutputStream that provides a writeDouble() method to write a double value in binary files. writeDouble
Conversion from double to int
a double type value to int type value. Description: This program will take a double value from console and provide the conversion to int type. The line... the mydouble double type value to myint int type data. Code: import java.io.
Conversion from double to long
a double type value to long type value. Description: This program will take a double value from console and provide the conversion to long type. The line... the mydouble double type value to mylong long type data. Code: import
Conversion from double to char
a double type value to char type value. Description: This program will take a double value from console and provide the conversion to char type. The line... the mydouble double type value to mychar char type data. Code: import
Conversion from double to String
to convert a double type value to String type value. Description: This program will take a double value from console and provide the conversion to String type... the double type value from console. The line String mystring = Double.toString
Conversion from double to short
a double type value to short type value. Description: This program will take a double value from console and provide the conversion to short type... the double type value from console. The line short myshort = (short)(mydouble
Conversion from double to float
a double type value to float type value. Description: This program will take a double value from console and provide the conversion to float type... the double type value from console. The line float myfloat = (float)(mydouble
Conversion from double to byte
a double type value to byte type value. Description: This program will take a double value from console and provide the conversion to byte type. The line... the mydouble double type value to mybyte byte type data. Code: import
Conversion from float to double
a float type value to double type value. Description: This program will take a float value from console and provides a conversion to double type data...); converts the myfloat float type value to mydouble double type value. Code
Conversion from long to double
a long type value to double type value. Description: This program will take... the mylong long  type value to mydouble double type value. Code: import... from long type to double type---"); System.out.println("Enter long type value
Conversion from double to boolean
to convert a double type value to boolean type value. Description: This program will take a double value from console and provide the conversion to boolean type... the double type value from console. The line boolean myboolean = (mydouble!=0
Conversion from byte to double
a byte type value to double type value. Description: This program will take a byte value from console and provides a conversion to double type data... the mybyte byte type value to mydouble double type data. Code: import java.io.
Convert String To Double
numeric type string value:" message and it converts into a double... class wraps a value of the primitive type double in an object. Finally, it we get...; In this section, we are going to convert a numeric type string value
How to get the correct value by calculating double values....
How to get the correct value by calculating double values....  Hello... { double min = 60; double cost = 0; double quotient = duration / min; double rem = duration % min; if (rem >= 0
Conversion from int to double
an int type value to double type data. Description: This program will take... to double type data. The line int a = Integer.parseInt(buffreader.readLine()); is used to read the int value from console and stored in a variable. The line double
How to get the correct value by calculating double values....
How to get the correct value by calculating double values....  Hello... { //DecimalFormat df = new DecimalFormat("#.##"); double min = 60; double cost = 0; double quotient = duration / min
Get the capacity of a double type buffer
Get the capacity of a double buffer In this tutorial we will see how to get size of a double buffer using capacity() method. Code: import java.nio.DoubleBuffer; public class 
how to retrieve the id value itself from the access database to drop down listbox in jsp
how to retrieve the id value itself from the access database to drop down... access database to drop down list box in jsp...plz send the code for that.....plz   <[email protected] import="java.sql.*"%> <select> <option value
ACCESS DATABASE FROM HTML
ACCESS DATABASE FROM HTML  I want to access sql 2008 database in html page without help of ADODB connection.. because if access through ADODB means there is a security problem. so, Access database in html page(client side
Compare two double type buffer's content
Compare two double buffer's content In this tutorial we will see how to create a double buffer and put content into it and then compare double value of one buffer with another. Code: import 
Get the smallest double greater than the given value
a value of double type. Now to determine it, we have invoked the nextDouble() method...Get the smallest double greater than the given value This section demonstrates you how to get the smallest double value greater than the given value. Java
problem in database
problem in database   thanks for web site. I want change this code to insert data into PostgreSql database using jsp,servlets. but i getting...){ out.println("Couldn't load database driver: " + e.getMessage()); } catch
Connect database in Access to Netbean?
Connect database in Access to Netbean?  how to connect database in micrsoft access to Netbean?i know it can be connected by using JDBC-ODBC bridge, can i know the steps in connecting the database? Is there any source code
Tutorials   
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java

Ads

 
Advertisement null

Ads