Thursday, 24 July 2014

JAVA PROGRAM FOR CONNECT TO DATABASE AND INSERT VALUES INTO STUDENT TABLE USING TYPE1 DRIVER


JAVA PROGRAM FOR CONNECT TO DATABASE AND INSERT VALUES INTO STUDENT TABLE USING TYPE1 DRIVER


import java.io.*;
import java.sql.*;
class Dabacon
   {
public static void main(String [] args)throws ClassNotFoundException,SQLException
      {
           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           String url="jdbc:odbc:myds";
           String user="mca1230";
           String pwd="mca1230";
           Connection con=DriverManager.getConnection(url,user,pwd);
           Statement st=con.createStatement();
           String sql="insert into student values(30,'nagaraju','m','mangalari')";
           int n=st.executeUpdate(sql);
if(n!=0)
{
System.out.println("successfully");
}
          st.close();
          con.close();
}
}


OUTPUT:-





Sunday, 29 June 2014

Html program for counting button click

                                 Html program for counting button click



<html>
<head>
<title>EVM</title>
<script type="text/javascript">
var p=0;
var q=0;
var r=0;
var s=0;
function a()
{
p=p+1;
}
function b()
{
r=r+1;
}
function c()
{
q=q+1;
}
function d()
{
s=s+1;
}
function total()
{
document.f1.fie1.value=p;
document.f1.fie2.value=r;
document.f1.fie3.value=q;
document.f1.fie4.value=s;
}
function rst()
{
p=0;
q=0;
r=0;
s=0;
}
</script>
</head>
<form name="f1">
<body>
<input type="button" value="TDP" style="background-color:yellow" onClick="return a()">
<br>
<input type="button" value="YSR" style="background-color:blue" onClick="return b()">
<br>
<input type="button" value="Congress" style="background-color:red" onClick="return c()">
<br>
<input type="button" value="JSA" style="background-color:green" onclick="return d()">
<br>
TDP <input type="text" name="fie1">
<br>
YSR <input type="text" name="fie2">
<br>
Congress <input type="text" name="fie3">
<br>
JSA <input type="text" name="fie4">
<br>
<input type="button" value="total" onClick="return total()">
<input type="reset" value="reset" onClick="return rst()">
</form>
</body>
</html>


Output: