foreach (GridViewRow item in GVStorage.Rows)
{
TextBox tbRawID = ((TextBox)item.FindControl("TBRawID"));
TextBox tbRawName = ((TextBox)item.FindControl("TBRawName"));
DropDownList ddlKind = ((DropDownList)item.FindControl("DDLKind"));
TextBox tbQuantity = ((TextBox)item.FindControl("TBQuantity"));
TextBox tbUnit = ((TextBox)item.FindControl("TBUnit"));
DropDownList ddlDepotCategory = ((DropDownList)item.FindControl("DDLDepotCategory"));
TextBox tbNotes = ((TextBox)item.FindControl("TBNotes"));
string sqlckid = "select count(*) from BaseRawMaterial where RawmaterialID = '" + tbRawID.Text + "'";
conn.Open();
comm.CommandText = sqlckid;
int count = (int)comm.ExecuteScalar();
conn.Close();
if (count > 0)
{
comm.CommandText = "select RawMaterial,Kind,Unit,PertainToDepartment,Notes from BaseRawMaterial where RawMaterialID = '" + tbRawID.Text + "'";
string SQLFDRawMaterial = string.Empty;
string SQLFDKind = string.Empty;
string SQLFDUnit = string.Empty;
string SQLFDPertainToDepartment = string.Empty;
string SQLFDNotes = string.Empty;
conn.Open();
using (SqlDataReader reader = comm.EndExecuteReader)
//comm 提示的
//错误 116 无法将类型“string”隐式转换为“System.Web.UI.WebControls.TextBox”
{
if (reader.Read())
{
SQLFDRawMaterial = Convert.ToString(reader["RawMaterial"]);
SQLFDKind = Convert.ToString(reader["Kind"]);
SQLFDUnit = Convert.ToString(reader["Unit"]);
SQLFDPertainToDepartment = Convert.ToString(reader["PertainToDepartment"]);
SQLFDNotes = Convert.ToString(reader["Notes"]);
}
}
conn.Close();
tbRawName = SQLFDRawMaterial;
ddlKind = SQLFDKind;
tbUnit = SQLFDUnit;
ddlDepotCategory = SQLFDPertainToDepartment;
tbNotes = SQLFDNotes;
}
这个是咋回事噢???
ddlKind = SQLFDKind;
tbUnit = SQLFDUnit;
ddlDepotCategory = SQLFDPertainToDepartment;
tbNotes = SQLFDNotes;tbRawName 这个不是textbox控件吗?这样写
tbRawName.Text=SQLFDRawMaterial
SqlCommand comm = new SqlCommand();
comm.Connection = conn;错误 116 无法将方法组“EndExecuteReader”转换为非委托类型“System.Data.SqlClient.SqlDataReader”。您是要调用方法吗? 这个提示是~~ ?
我晕,哪有什么EndExecuteReader这个方法??? using (SqlDataReader reader = comm.EndExecuteReader)=========> using (SqlDataReader reader = comm.ExecuteReader())
EndExecuteReader()
using (SqlDataReader reader = comm.EndExecuteReader("由调用 BeginExecuteReader 返回的 IAsyncResult变量"))