Pregunta

I have an aspx page which allows a user to submit modified entries into the database, but when the user clicks Submit to fire the stored procedure I want to first run a check to see if a modified row with the same relationship exists.

I am passing the results of the following query:

SELECT SwitchRoom.ModifiedID FROM SwitchRoom WHERE 
    SwitchRoomID = @ChkSwitchRmID", constring; 

into a DataReader to determine if that relationship exists.

I need it to determine whether the reader returns NULL to allow the procedure to execute, if it doesn't, then don't allow the user to save the information.

I've tried the following:

if (dbreader = NULL)
{
 Fire Procedure
}
else
{
 "Error Message"
}

and I've even tried passing the reader into a datatable and running it against that without any luck.

How do I check the restults of a DataReader for null?

No hay solución correcta

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top