-1

在assign.aspx页面中我有

    foreach (ListItem li in CheckBoxList1.Items)
    {
        if (li.Selected)
        {
            str1+=li.Value+" ";
        }

    }                
    sql = " insert into assgnmovie values ('"+mvnm+"','"+thnm+"','"+date+"','"+str1+"')";
    SqlDatabase.Insert(sql);

} 现在在 booking.aspx 页面

protected void ddlMov_SelectedIndexChanged(object sender, EventArgs e)
{
    DataSet ds = new DataSet();
    SqlDataAdapter adp = new SqlDataAdapter("select thname from assgnmovie where mvname='"+ddlMov.SelectedItem.Value+"'",con);
    adp.Fill(ds);
    ddlTheater.DataSource = ds;
    ddlTheater.DataValueField = "thname";
    ddlTheater.DataBind();
    ddlTheater.Items.Insert(0, new ListItem("SELECT", "0"));
}


protected void ddlTheater_SelectedIndexChanged(object sender, EventArgs e)
{
    DataSet ds = new DataSet();
    SqlDataAdapter adp = new SqlDataAdapter("select showtime from assgnmovie where mvname='"+ddlMov.SelectedItem.Value+"' and thname='"+ddlTheater.SelectedItem.Value+"'",con);
    String a = adp.ToString();
    String b = a.Substring(1, 6);
    ddlShow.Text = b;
     adp.Fill(ds);

我如何拆分字符串并将单词作为 ddlshow.list 的数据集???

4

1 回答 1

0

尝试这样的事情:

protected void ddlTheater_SelectedIndexChanged(object sender, EventArgs e)
{
    DataSet ds = new DataSet();
    SqlDataAdapter adp = new SqlDataAdapter("select showtime from assgnmovie where mvname='"+ddlMov.SelectedItem.Value+"' and thname='"+ddlTheater.SelectedItem.Value+"'",con);
    String a = adp.ToString();
    String b = a.Substring(1, 6);
    ddlShow.Text = b;
    adp.Fill(ds);

    ddlTheater.DataSource = ds;
    ddlTheater.DataValueField = "showtime";
    ddlTheater.DataBind();
 }
于 2013-08-22T19:35:12.083 回答