从表的行中获取组合框值并匹配 [英] get the combobox values from the row of the table and match

查看:85
本文介绍了从表的行中获取组合框值并匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友我正在制作一个窗口基础应用程序

现在我已经到了某个地方这就是为什么我需要你专家的帮助。



hello friends i am making one window base application
now i have struck somewhere thats why i need help from you experts.

try
{
    con = new SqlConnection("Data Source=.;Initial Catalog=DSIIDC2;Integrated Security=True");
    con.Open();
    string str = "select * from addcaasedetails";

    SqlDataAdapter da = new SqlDataAdapter(str, con);
    DataSet ds = new DataSet();
    da.Fill(ds);

    for (int i = 0; i < ds.Tables["addcaasedetails"].Rows.Count; i++)
    {
        if (ds.Tables["addcaasedetails"].Rows[i]["caseno"] == casedetails.ValueMember)
        {
            dataGridView1.Visible = true;
        }
    }

    }
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}





i希望通过combobox.please从行和匹配中获取值,在此代码中找到我错的地方。请把它弄清楚



i want to get value form the row and match from the combobox.please find where i am wrong in this code. please make it crrect

推荐答案

if (ds.Tables["addcaasedetails"].Rows[i]["caseno"].ToString() == casedetails.ValueMember)
{
  dataGridView1.Visible = true;
}



如果它不起作用然后告诉我


if its not working then let me know


这篇关于从表的行中获取组合框值并匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆