View Single Post
  #1 (permalink)  
Old 03-26-2008, 01:01 PM
geeta_ravikanti geeta_ravikanti is offline
Member
 
Join Date: Mar 2008
Posts: 13
geeta_ravikanti is on a distinguished road
unable to exceute stored procedures
import java.sql.*;


public class CrTable
{

//Add an employee to the database.
public static void addEmp(int emp_id, String emp_f_name,
String emp_l_name,float emp_salary) {

System.out.println("Creating new employee...");

try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");

Connection con=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=master;user=sa;passwor d=remora");

System.out.println("connceted----->"+con.getClass());

String sql =
"INSERT INTO emp " +
"(emp_id,emp_f_name,emp_l_name,emp_salary)" +
"VALUES(?,?,?,?)";
PreparedStatement pstmt = con.prepareStatement(sql);
pstmt.setInt(1,emp_id);
pstmt.setString(2,emp_f_name);
pstmt.setString(3,emp_l_name);
pstmt.setFloat(4,emp_salary);
pstmt.executeUpdate();
pstmt.close();

}
catch(Exception e)
{
System.err.println("ERROR! Adding Employee: "
+ e.getMessage());

}

}
}



When i am running the above program I am getting the out put like this

The Selection Doesnot support Runmode
what is the meaning of that error
how can i resolve this problem
any one can help solving this problem

Geeta
Reply With Quote
Sponsored Links