I want to check weather my database contain row or not?
and if it contain then i want to delete that row. this process can be done during run time of page.

What exactly the issue that you are experiencing? are you asking DB query?

you can count the row inside the table by Count(*) an aggregate function.Then if count greater tahn Zero than.delete that row.

suppose student table has lots of row but i want to check whether that table contain row. That is identify by some value like A101(Primary key). So that i want to check student table has any row that contain A101. what should i write in IF condition.

I think you are asking the DB query to do this. Well, I guess below is what you are looking for...

--In SQL Server
IF EXISTS(SELECT 1 FROM Student WHERE StudentID = 101)
BEGIN
	DELETE FROM Student WHERE StudentID=101
END

You can create a stored procedure with the above command and you can call it from the code wherever you want.

Or

You can execute this command directly from the code using SqlCommand.

Sorry for the delay.....I was on leave!!!!!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.