How to check for a particular record whether it is present or not in dataset if the record is not present i want to display a message as no records what is the code for checking

Showing Answers 1 - 7 of 7 Answers

Madduri Rajasekhar

  • Sep 21st, 2006
 

You can check by record or by rows, if it contains zero then append it, if at end use FOR loop to acesss the first record until-1

  Was this answer useful?  Yes

Bhaskar Nandi

  • Oct 17th, 2006
 

Answer may be that we can use int32.recordsaffected .If it it 0 then there was no record..otherwise some records exist.

  Was this answer useful?  Yes

satnam singh

  • Oct 23rd, 2006
 

You can use followind methodtake reference to View( DataSet.Tables(indexOfTable).DefaultView).

  Was this answer useful?  Yes

satnam singh

  • Oct 23rd, 2006
 

You can use following methoda) take a reference to the defaultview of the required table in dataset.b) initialize RowFilter = "ColumnName=value " ( you can you multiple column condtions seperated by ' And ' keywordc) check the Count property of viewd) if ( view.Count > 0 ) the record exists )

  Was this answer useful?  Yes

Savi

  • Mar 9th, 2007
 

SqlDataReader.HasRows

Gets a value indicating whether the SqlDataReader contains one or more rows.

  Was this answer useful?  Yes

ramzan_06

  • Mar 15th, 2007
 

if you are using "DataReader" then

if DataReaderName.HasRows then
             statements
else
             statements
end if


if you are using "DataSet" then

if DataSetName.TABLES.("tablename").ROWS.COUNT=0 THEN

               statements.


end if

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions