把:
<asp:datagrid id="Datagrid1" Visible="true" Runat="server" CssClass="DatagridDemandComeOut3" ShowHeader="False"
AutoGenerateColumns="False" Width="600" Height="30">
<columns>
<asp:templatecolumn>
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem,"NumberPlate")%>'
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
的值(只有一条数据)赋予(this.Datagrid1.Items处)
public void InsertIntoDataCarGarage()
{
connectionstr();
shbConn.Open();
shbInsertData="INSERT INTO CarPageAGarage(" + " [Date] " + " ," + " NumberPlate "
+ " ," + " Title " + " ," + " Unit " + " ," + " Amount " + " ,"
+ " UnitPrice " + " ," + " [Sum] " + ") Values" 
+ "('" + CarPageAGaragetxtDate.Value + "','" + this.Datagrid1.Items + "','"
+ txtTitle.Value + "','" + txtUnit.Value + "','" + txtAmount.Value + "','"
+ txtUnitPrice.Value + "','" + txtSum.Value + "')";
shbComm=new OleDbCommand(shbInsertData,shbConn);
shbComm.ExecuteNonQuery();
shbConn.Close();
}--------------------------------
this.Datagrid1.Items 处得到值为:System.Web.UI.WebControls.DataGridItemCollection

解决方案 »

  1.   

    integer.parase(this.Datagrid1.Items.count)
    这样才能得到datagrid1中项的数目
      

  2.   

    integer.parase(this.Datagrid1.Items.count)找不到类型或命名空间名称"integer"
      

  3.   

    int.Parse(this.Datagrid1.Items.count)
      

  4.   

    int.Parse(this.Datagrid1.Items.count)
    ---------------------------------------------与"int.Parse(string)"最匹配的重载方法具有一些无效参数
    参数"1":无法从"int"转换为"string"
      

  5.   


    int.Parse(this.Datagrid1.Items.count)改成:this.Datagrid1.Items.Count.ToString();后,值到为"1"