Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The error

Column 'Rate' does not belong to table .
protected void btnAdd_Click(object sender, EventArgs e)
    {
        int count = 0;

        DataTable myTable = new DataTable();
        myTable = CreateDataTable();
        if (Convert.ToInt32(Session["Count"]) != 0)
            myTable = (DataTable)Session["myDatatable"];

        // tot = Convert.ToInt32(tot) + 12wConvert.ToInt32(txtAmt.Text);

        DataRow row;
        row = myTable.NewRow();
        count = myTable.Rows.Count + 1;

        row["Size"] = cmbSize.SelectedItem.Text;
        row["SizeID"] = cmbSize.SelectedValue;

        row["Rate"] = Convert.ToInt64(txtRate.Text);
        row["Noofcopies"] = txtNoofcopies.Text;
        row["Total"] = txtTotal.Text;
        myTable.Rows.Add(row);
        Session["Count"] = Convert.ToInt32(Session["Count"]) + count;
        Session["myDatatable"] = myTable;
        //lblTotal.Text = Convert.ToString(tot);
        Grid();
    }
Posted
Updated 20-May-11 1:06am
v2
Comments
Prerak Patel 20-May-11 7:03am    
post some code and DB structure

1 solution

From error you have mentioned following are the possibilities
1) column 'Rate' is not there in myTable
2) data containing Rate is returning with incorrect column name or 'No column name'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900