on 03-12-2008 4:27 AM
Hi All
i am using SQL Server 2005 , i want to select the data based on the user input in where condition,
but i am not sure what to give in where condition,can anyone have any idea on this
SELECT [NO]
,[NAME]
,[PAGE_COUNT]
FROM [DS].[DB].[tablename]
where [NO]=???
Regards
Chaitanya.A
Which software are you using to interface to SQL server?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
public String getEmployeeName(String employeeNumber)
{
// TODO : Implement
String name = new String();
String exception = new String();
try
{
InitialContext initialContext = new InitialContext();
DataSource dataSource =(DataSource) initialContext.lookup("jdbc/XXXX");
java.sql.Connection connection = dataSource.getConnection();
PreparedStatement stmt =connection.prepareStatement("SELECT [NAME]FROM [XXX].[ASDF].[ABCD] where [NO]=?");
stmt.setString(1,employeeNumber);
ResultSet result = stmt.executeQuery();
while (result.next())
{
name = result.getString("Name");
}
connection.close();
return name;
}
catch (Exception e)
{
exception = "Exception";
return exception;
}
}
i used the above function to achieve my requirement
Thanks
Chaitanya.A
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.