retreive integer data from database
i made a table named result having two fields 1>rollno 2>marks i creates a gui where i use a textfield and two buttons "ok" and "cancel" i want to take input from textfield as an integer(rollno) and the marks associated with that must be displayed.i write the following code but the error appears is "no specific value for parameter 1" so please suggest me where t am wrong.
coding written in "ok" button
public void actionPerformed(ActionEvent e){
if(e.getSource()==b1){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection cn=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb" +
"?user=root&password=lalit&database=mydb");
String url="select marks from student where rollno=?";
PreparedStatement stmt=cn.prepareStatement(url);
ResultSet rs=stmt.executeQuery();
stmt.setString(1,tf1.getText().toString());
int n=Integer.parseInt(rs.getString(2));
System.out.println("Your marks is "+ n);
stmt.close();
cn.close();
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
}
}
if(e.getSource()==b2){
this.dispose();
}
}
}
View Answers
Related Tutorials/Questions & Answers:
retreive integer data from databaseretreive integer data from database i made a table named result...=lalit&
database=mydb");
String url="select marks
from student where rollno... and two buttons "ok" and "cancel" i want to take input
from textfield
Advertisements
selecting data from databaseselecting
data from database how to select
data from database using Dao in struts
Hi,
You have to load the
data from database using hibernate and send the
data in a Java file object to jsp page.ADS_TO_REPLACE_1
retrive data from database retrive
data from database hi..
i made a application form. it's have attribute s.no,name,roll no and i enter a few records. now i want to view all record not in
database access sheet i want to view it at any another
retrive data from database?retrive
data from database? hellow
i have a
database sheet name as db1. it's contain sixty(60) sn,name ,rollno(primary key),father's name etc...
from db1 and enter value in text box according there name,rollno and save
delete data from database - SQLdelete
data from database HOw to delete specific
data from table>
I want to delete one record
from database.
Thnx Hi friend,
--------------------------------------------
Visit for more information
To retrive data from database - StrutsTo retrive
data from database How to get values ,when i select a select box in jsp and has to get values in textbox automatically
from database?
eg... come to jsp page automatically
from database Problem in accessing data from DatabaseProblem in accessing
data from Database hi.....
i'm making a project on servlet and jsp with ms access 2007 at the backend. One field in my
database is text and all others are of currency
data type. If i enter 0 or null value
retrieve data from database with hyperlinkretrieve
data from database with hyperlink sir....i have one table called 'name' having two values i have to retrieve those
data with a hyperlink and show in browser and if we click hyperlink its shows his sub categories....how
retrieve data from mysql databaseretrieve
data from mysql database hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant
data from mysql
database using php.... below my code is that..
<html>
<head>
Getting Textbox data from database data from database and display it on the textboxes.
<%@page language="java...Getting Textbox
data from database When i m trying to get
data in textbox as readonly
from database i m getting following error.and my code is shown
Getting Textbox data from database;Here is a jsp code that retrieves
data from database and display...Getting Textbox
data from database When i m trying to get
data in textbox as readonly
from database i m getting following error.and my code is shown
Data retrieve from mysql databaseData retrieve
from mysql database Hi sir,
please give some example of jsp code for retrieving mysql
database values in multiple dropdown list...
from the dropdown, related
data will get displayed on the textboxes. Here we have
GWT -- retrive the data from DatabaseGWT -- retrive the
data from Database the user can create an event. In the create page, we have three buttons. Save as draft, preview and save... button, you have to create a dynamic jsp which should read the contents
from retrieve data from database using jsf retrieve
data from database using jsf Hello
I want an example of source code to retrieve
data from database
i have a
database (oracle) name as db1 it's contain table 'author' composed of three columns idauthor(primary key
Retrieving Data from Database to fill Combo BoxRetrieving
Data from Database to fill Combo Box Sir,
I have a JSP Page with a combo box and a label. I have a
database that has two fields id... displaying path that is stored in the
database but not the image itself. Kindly
Retrieve multiple data from database into Table..... Retrieve multiple
data from database into Table..... hi...........
I want to Retrieve multiple
data from database into Table but i am not able...
database i have attributes pH, phosphate, ....... month, year.........
so its
Display Data from Database in JSP, to show
data from the
database
click on the link that calls another .jsp file named...;/head>
<body>
<h2>
Data from the table 'stu_info' of
database...;
<html>
<head>
<title>display
data from jfreechart display from access database data.jfreechart display
from access
database data. I have made a
database... to retrieve the
data from the access
database using prepared statement and then display... is to be done in a servlet..
Note that it is a access made
database.
How can I
Retrieve data from database in swing applicationRetrieve
data from database in swing application I want to retrive
data(doctor name,specilization,date)
from my sql
database...();
ResultSet rs=st.executeQuery("select *
from data where id=1");
while
Application reading data from JDBC database" should read
data from from a JDBC
database named PrimeGame with TABLE PRIMEGAMETABLE...Application reading
data from JDBC database I would like to develop an online registration system that captures details of potential candidates
how to get data from database into dropdownlist in jsphow to get
data from database into dropdownlist in jsp Can anybody tell me what is the problem in this code as i am not able to fetch the
data from... tutorial go through the link JSP Get
Data Into Dropdown list
From Database
Select data from Table in Database Select
data from Table in
Database
... the selected
data from table in
database. The
select query in the
database retrieve... the table,
from where the
data is retrieve.
Understand with Example
export data from database to excel sheet - JDBCexport
data from database to excel sheet I am facing a problem about exporting required
data from database table to ms-excel sheet.i mean whenever I... rs=st.executeQuery("Select *
from student");
HSSFWorkbook wb = new
How to display data from database in a TableViewHow to display
data from database in a TableView I need to populate a TableView (JavaFx) with
database items. I designed the TableView in JavaFx... at this.
The classes:
This is the Class that creates the
database data object:
import
jsp programe for displaying data from databasejsp programe for displaying
data from database i am using JSP.i want to insert
data into
database and also want to display the things i have entered..."')");
ResultSet rs = stmt.executeQuery( "SELECT *
FROM data");
String id
jsp programe for displaying data from databasejsp programe for displaying
data from database i am using JSP.i want to insert
data into
database and also want to display the things i have entered..."')");
ResultSet rs = stmt.executeQuery( "SELECT *
FROM data");
String id