C#:checking existing record in database Mysql

Posted by Meko on Stack Overflow See other posts from Stack Overflow or by Meko
Published on 2010-06-02T21:07:40Z Indexed on 2010/06/02 21:14 UTC
Read the original article Hit count: 196

Filed under:
|
|
|

HI.I searched this question inform and I found solution to change column property Unique Index.Now If I try to insert same record cmd.ExecuteNonQuery() gives error that record exist ,but how can use this exception to give user a message that record exist and must enter new one ? I am trying to make some thing like

if(cmd.ExecuteNonQuery() !=true )
{
 MessageBox.Show("User Exists");
}

But I dont know what returns cmd.ExecuteNonQuery() ?

Or I must get records using reader in table and compare them with text in Textfiel?

© Stack Overflow or respective owner

Related posts about c#

Related posts about mysql