PDA

View Full Version : سوال در مورد گرید



نیما حتمی
سه شنبه 06 اردیبهشت 1390, 13:26 عصر
با سلام

من می خوام به محض خروج از یک سلول گرید در بانک یک سرچی انجام بشه تا ببینم اون مقداری که کاربر در اون سلول وارد کرده وجود دارد یا نه
کد زیر رو در رویداد CellEndEdit نوشتم ولی هیچ اتفاقی نمی افته چه در یانک اون مقدار باشه چه نباشه


SqlConnection connect = new SqlConnection();
connect.ConnectionString = Total.Properties.Settings.Default.Connection.ToStr ing();
if (dataGridView1.CurrentCell.ColumnIndex == 1)
{
try
{
connect.Open();
SqlDataAdapter d = new SqlDataAdapter("select * from AccCoding where AccCode='" + a.Test + "'", connect);
DataTable f = new DataTable();
d.Fill(f);
if (f.Rows.Count < 0)
{
FarsiMessageBox.FMessageBox.Show("اين کد در کدينگ حسابها تعريف نشده است", "هشدار", FarsiMessageBox.FMessageBoxButtons.OK, FarsiMessageBox.FMessageBoxIcons.Warning);
// dataGridView1.CurrentRow.Cells[1].Selected = true;
}
else
{
}
}
catch (Exception exp)
{
}
finally
{
connect.Close();
}
}
else
{
}


دوستان کمکم کنید لطفا