Saturday 6 April 2013

Data type mismatch in criteria expression.

While I Am Trying To Retrieve Data From The Database by Giving Sql Query ..I Got The Bug "OleDbException was unhandled,Data type mismatch in criteria expression"  As Shown In The Picture Below:

Actually in My Sql Query I am trying To Give An Integer As The Parameter..So While Giving Integer We Should Not Put The Parameter In Double Quotations..That Is We Have to Give as:
cmd.commandcmd.CommandText = "SELECT StarT,Paadam,VarnamT,VasyamT FROM Nakshatra_Kutami Where Paadam="+ padam; (This Is Correct Format When We Are Giving Parameters As Integer Values)

but I Had Given As :
cmd.CommandText = "SELECT StarT,Paadam,VarnamT,VasyamT FROM Nakshatra_Kutami Where Paadam='"+ padam+"'"; (This Is Correct Format, Incase We Are Giving Text/String As Parameter But Incase Of Giving Integer as Parameter It Is Incorrect)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.