I need Help Setting a Condition on an DataObject Reader Can You Help Me?  
Author Message
Shawn Rheal





PostPosted: Visual C# Express Edition, I need Help Setting a Condition on an DataObject Reader Can You Help Me? Top

I need to check to make sure that the Parameter on my objcommand is calling the correct Data so that My Data Reader Knows that it is calling the right parameter value or not. How can I do a check on that parameter before it opens the database and executes a read on it.

Code: Example-

objPayAccValid.Parameters[ "PayPal_AccountHolder" ].Value = txtPalUserEmail.Text; <-- What if The Data in this textbox is not matching the data in the database how can i run a check. I tried using a Try Catch Format Exception But this wont work, cause this parameter is a string data type. So even though it doesnt match doesnt necssarly mean the data type is wrong so it wont catch the miss match. This parameter has to match in order to run a proper read execution.

objTransaction.Open();

OleDbDataReader objReader =

objPayAccValid.ExecuteReader();

objReader.Read();

str_AccessGranted = Convert.ToString(

objReader[ "Password" ] );

objReader.Close();

objTransaction.Close();

 




Visual Studio Express Editions13  
 
 
ahmedilyas





PostPosted: Visual C# Express Edition, I need Help Setting a Condition on an DataObject Reader Can You Help Me? Top

not sure if I quite follow

if there are no results returned, then you can check to see if the dataReader.HasRows - which indicates if the results in the "buffer" contains any records (rows) and if they do, results exist then go through them the way you want and handle it.

Any exceptions thrown by SQL will be thrown in the SqlException with details of the error.

Are you also able to post your SQL Query