asp:DropDownList 数据表中的三倍结果

asp:DropDownList tripling results in datatable

我正在使用 DropDownList:

<asp:DropDownList ID="ddlCategory" runat="server"></asp:DropDownList>

并将其与我的数据库绑定,如下面的代码所示:

 ddlCategory.DataSource = readCategory.Category();
 ddlCategory.DataTextField = readCategory.Category().Columns[1].ToString();
 ddlCategory.DataValueField = readCategory.Category().Columns[0].ToString();
 ddlCategory.DataBind();

我的 ddlCategory 必须显示此数据:'Microsoft'、'Apple'、'Google' 但显示的是三倍。

readCategory 运行良好。 在我的数据库中它不是三倍。

这是怎么回事? (如果需要我可以post更多细节)

既然你说 "tripled" 我猜对 Category() 的调用是附加到某种列表中。

你能post readCategory.Category() 中的代码吗?

这是readCategory.Category()

public DataTable Category()
{
    DataTable dt = new DataTable();
    SqlDataAdapter sda = new SqlDataAdapter("select * from tbl_category", conn);
    sda.Fill(dt);
    return dt;
}

conn 是我的字符串连接。