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









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 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 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 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 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 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 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 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 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 What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code

Ads

 
Advertisement null

Ads