无法隐式转换类型' int'到' System.Data.DataTable'?8

时间:2014-10-23 09:54:53

标签: c#

我必须更新" cad_assign"从下拉列表中根据所选状态单击“提交”按钮时的列。单击提交按钮时,值1应插入cad_assign列。

代码:

 protected void Button1_Click(object sender, EventArgs e)
    {
        SiteDetailsDataSetTableAdapters.tbl_SiteDetailsTableAdapter cd;
        cd = new SSiteDetailsDataSetTableAdapters.tbl_SiteDetailsTableAdapter();
        DataTable dt = new DataTable();
        dt = cd.GetUpdateCadAssign(ddlState.SelectedValue); // error shown here
    }

查询1:

UPDATE tbl_site_details SET cad_assign = 1 WHERE (state1 = @state1)

ASPX:

<asp:DropDownList ID="ddlState" runat="server" Width="150px" AutoPostBack="True" OnSelectedIndexChanged="ddlStatee_SelectedIndexChanged"> </asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Assisgn" OnClick="Button1_Click" />

1 个答案:

答案 0 :(得分:0)

下面给出的代码完美无缺。谢谢大家。

protected void Button1_Click(object sender, EventArgs e)
    {
        SiteDetailsDataSetTableAdapters.tbl_SiteDetailsTableAdapter cd;
        cd = new SSiteDetailsDataSetTableAdapters.tbl_SiteDetailsTableAdapter();
        cd.GetUpdateCadAssign(ddlState.SelectedValue);
    }