cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SQL 2005 , Where condition in Select statement

Former Member
0 Likes
238

Hi All

i am using SQL Server 2005 as a backend for webservices, i want to select the data based on the user input in where condition,

SELECT [NO]
      ,[NAME]
      ,[PAGE_COUNT]
  FROM [DS].[DB].[tablename]
where [NO]=???

Ex: i will pass the NO to the webservice to get the respective data from SQL,but i am not sure what operand to give in where condition,does anybody have idea on this

Thanks and Regards

Chaitanya.A

View Entire Topic
Former Member
0 Likes

Hi,

PreparedStatement stmt = null;

String query="SELECT [NO]

,[NAME]

,[PAGE_COUNT]

FROM [DS].[DB].[tablename]

where [NO]=?";

stmt = con.prepareStatement(QUERY);

stmt.setInt(1, no);

rs = stmt.executeQuery();

where "no" is the number which you get from webservive.

Regards,

Sudhir