如何将数据插入动态表? [英] How to insert data to dynamic table?

查看:68
本文介绍了如何将数据插入动态表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要解释一下我的概念.
我有一个下拉列表和一个动态表...
当我在下拉列表中选择时,我希望根据下拉列表中的选定值在动态表中更改数据...以及如何将数据库链接到表....

I''l explain u my concept..
I have a dropdownlist and a dynamic table...
when i select in dropdownlist i want data to be changed in dynamic table according to the selected value in dropdown... and also how to link database to the table....

推荐答案

在SelectionIndexChanged()上,触发对该特定项目的查询并填充动态表.

这是简单的方法.

但是我还不了解您关于将数据库链接到表的其他问题.您在这里到底想要什么?
On the SelectionIndexChanged(), Fire The Query For That particular item and fill your dynamic table.

This is the simple way to do that.

But i haven''t understood your other question about linking database to table. What you exactly want here?


private void cmbDropDownBox_SelectionIndexChanged()
{
    string myStr = "";
    if(cmbDropDownBox.SelectedIndex != -1)
    {
        if(cmbDropDownBox.Text == "Assigned")
        {
            //Fire The Query For Status = "Assigned"
            myStr = "SELECT * FROM YourTableName WHERE Status = '" + cmbDropDownBox.Text + "'";
            //Store The Data Into the Datatable
            //And From the Datatable, display it into your grid
        }
        else if(cmbDropDownBox.Text == "Not Assigned")
        {
            //Fire The Query For Status = "Not Assigned"
            myStr = "SELECT * FROM YourTableName WHERE Status = '" + cmbDropDownBox.Text + "'";
            //Store The Data Into the Datatable
            //And From the Datatable, display it into your grid
        }
    }
}



希望你能从中得到一个主意...



Hope You Will Get An Idea Through This...


这篇关于如何将数据插入动态表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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