Easy A
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 Database access related issue

View previous topic View next topic Go down 
AuthorMessage
Lushish
Member
Member
Lushish

Posts : 7
Join date : 2011-06-05

Database access related issue Empty
PostSubject: Database access related issue   Database access related issue EmptyWed Jun 29, 2011 8:21 am

Dear Sir,
I have accessed one field from database with datareader.Now I want to check it and the accordinngly want to increase or decrease it.
(e.g. If we got 4 from database and this 4 has been stored in the datareader object(e.g.dr[0] contains 4) now i want to check it aginst 5 if it is 5 then display 6).
I tried below mentioned code for the same -
SqlDataReader dr = null;
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
if (dr.GetInt32(0) == 5)
{
Response.Write("6");
}
}
}

But it is giving Exception in if condition is that Specified cast is not valid.
How it is possible.
Pls help me out.
Back to top Go down
 

Database access related issue

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» PHP variable issue with database
» C / C++ code for Database connectivity
» storing the data to database from input panel
» How do i select entries from a mySQL database to use as options in a form?
» Cfdiv Binding Variable with # sign Issue

Permissions in this forum:You cannot reply to topics in this forum
Easy A :: Database access related issue Edit-trash Useless :: Trash-