String MyText;
//添加数据
if (RadioButtonList1.Text.ToString() == "工程报表" && RadioButtonList1.Text.ToString() == "实情汇报")
{ MyText = "工程报表及实情汇报"; }
if (RadioButtonList1.Text.ToString() == "工地检查通知" && RadioButtonList1.Text.ToString() == "工地检查通报")
{ MyText = "工地检查通知及通报"; }
DataRow addrow = ds2.Tables[0].NewRow();
addrow[1] = DropDownList1.Text + "年" + DropDownList2.Text + "月";
addrow[2] = RadioButtonList1.SelectedIndex + 1;
addrow[3] = "files/" + DropDownList1.Text + "年/" + MyText + "/" + FileUpload1.FileName;
ds2.Tables[0].Rows.Add(addrow);
GridView1.DataSource = ds2.Tables["baobiao"]; //显示,绑定
GridView1.DataBind();
//da2.Update(ds2, "baobiao");
-------------------------------------------
“/showbaobiao”应用程序中的服务器错误。
--------------------------------------------------------------------------------
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0165: 使用了未赋值的局部变量“MyText”
源错误:
行 126: addrow[1] = DropDownList1.Text + "年" + DropDownList2.Text + "月";
行 127: addrow[2] = RadioButtonList1.SelectedIndex + 1;
行 128: addrow[3] = "files/" + DropDownList1.Text + "年/" + MyText + "/" + FileUpload1.FileName;
行 129: ds2.Tables[0].Rows.Add(addrow);
行 130: GridView1.DataSource = ds2.Tables["baobiao"]; //显示,绑定