Hi There !
I have a table for e.g. have some here fields
------------------------------------------------
ID FNAME LNAME YearReg RegNo
------------------------------------------------
1 Anna Wacker 1970 108
2 Antonio Krschne 1970 113
3 Thomas Edwards 1972 116
4 Christina Ludick 1970 110
5 Martin Grilo 1972 102
-----------------------------------------------
at the first I want to check in the table if YearReg=1970 , is RegNo is duplicate or not ? and then Update(Edit) the record :
-----------------------------------------------
.....
strSql =@"SELECT RegNo WHERE RegNo=@s1 AND YearReg=1970";
oda_Edited.SelectCommand.Parameters.AddWithValue(" @s1", txtRegNo.Text);
.....
.....
DataTable dt_Edited = new DataTable();
dt_Edited.Clear();
oda_Edited.Fill(dt_Edited);
if (dt_Edited.Rows.Count > 0)
{
MessageBox.Show("Already Exists!! ");
txtRegNo.Focus();
}
else
{
OleDbCommand ocmd_Edited02 = new OleDbCommand();
ocmd_Edited02.CommandText = @"UPDATE myTable SET ....
----------------------------------------------------
But I can not Update the record (message show "Already Exists!!")
Thanks for any Help ...