I am getting 2 errors.

'string' does not contain a definition for 'Fill' and no extension method 'Fill' accepting a first argument of type 'string' could be found

and

'System.Data.DataRow' does not contain a definition for 'Item' and no extension method 'Item' accepting a first argument of type 'System.Data.DataRow' could be found

Here is the code:

public partial class account_Default2 : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("PartNumber");
        dt.Columns.Add("Qty");
        dt.Columns.Add("Price");
        dt.Columns.Add("ExtPrice");
        dt.AcceptChanges();
        Session["DT"] = dt;
        GridView1.Visible = true;
        BindGrid();
    }
}



private void BindGrid()
{
    GridView1.DataSource = Session["DT"];
    GridView1.DataBind();
}



protected void Button1_Click(object sender, EventArgs e)
{

    // 1off


    WebReference.WebServiceTyped ws = new WebReference.WebServiceTyped();
    WebReference.CheckPartStatus pq = new WebReference.CheckPartStatus();
    DataTable dttemp = new DataTable();
    Session["DT"] = dttemp;

    pq = ws.CheckPartNumberStatus(TextBox1.Text, TextBox2.Text, "1", "", "", "1");

    string price = pq.Parts[0].Cost.ToString();

    DataRow dr = default(DataRow);
    dr = dttemp.NewRow();
    dr["PartNumber"] = TextBox1.Text;
    dr["Qty"] = TextBox3.Text;
    dr["Price"] = price;
    dr["ExtPrice"] = Convert.ToDouble(TextBox3.Text) * Convert.ToDouble(price);
    dttemp.Rows.Add(dr);
    Session["DT"] = dttemp;
    dttemp = null;
    BindGrid();
}
protected void Button2_Click(object sender, EventArgs e)
{

    WebReference.WebServiceTyped ws = new WebReference.WebServiceTyped();
    WebReference.CheckPartStatus pq = new WebReference.CheckPartStatus();

    string sql = "SELECT PartNumber, Qty FROM PackageDetail where Package_Name = 'SILVERADO4'";

    DataTable dtparts = new DataTable();

    String da = ConfigurationManager
       .ConnectionStrings["connectionString"].ConnectionString;

    da.Fill(dtparts);

    //Dim Parts As String = "RANRS5114,RANRS5116,RANRS5118"
    //Dim strs() As String
    //strs = Parts.Split(",")

    for (int i = 0; i <= dtparts.Rows.Count - 1; i++)
    {
        DataTable dttemp = new DataTable();
        Session["DT"] = dttemp;

        pq = ws.CheckPartNumberStatus(dtparts.Rows[i].Item["PartNumber"], "", "1", "", "", "1");

        string price = pq.Parts[0].Cost.ToString();

        DataRow dr = default(DataRow);
        dr = dttemp.NewRow();
        dr["PartNumber"] = dtparts.Rows[i].Item["PartNumber"];
        dr["Qty"] = dtparts.Rows[i].Item("Qty");
        dr["Price"] = price;
        dr["ExtPrice"] = dtparts.Rows[i].Item["Qty"] * Convert.ToDouble(price);
        dttemp.Rows.Add(dr);
        Session["DT"] = dttemp;
        dttemp = null;
    }
    BindGrid();
}
}

Would really appreciate it if someone helped me, I have tried everything to fix it.

Thank you.

Related posts

Recent Viewed