Friday, June 30, 2006

[java] Shows update query (SQL)

Shows update query (SQL)

import java.util.*;

import java.sql.*;

public class test

{

public static void main(String args[])

{

try

{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con=DriverManager.getConnection("jdbc:odbc:hide","sa","");

PreparedStatement st = con.prepareStatement("insert login values (?,?,?,?,?)");

st.setString(1,login);

st.setString(2,pass);

st.setString(3,email);

st.setString(4,address);

st.setString(5,phone);

int r=st.executeUpdate();

if (r!=0)

out.println("Successfully registered");

else

out.println("Error in registration");

}

catch(Exception e)

{

out.println(e);

}

}

Pradyut
http://pradyut.tk
http://spaces.msn.com/members/oop-edge/
http://groups-beta.google.com/group/oop_programming
India

No comments: