Hey there,
I have a web app. project in which i have added a new project to the solution for data accessing DAL it has a class SQLHelper.cs that i has referenced to my website.
Now in my SQLHelper.cs class, I Am writing this--
SqlConnection conn = GetConnection();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "INSERT INTO tblProducts(ProductName,QtyAvailable,Rate) VALUES(@ProductName,@QtyAvailable,@Rate)";
cmd.Parameters.Add("@ProductName", SqlDbType.VarChar).Value = ((TextBox)GridView1.Rows[0].Cells[2].Controls[0]).Text;
cmd.Parameters.Add("@QtyAvailable", SqlDbType.SmallInt).Value = ((TextBox)GridView1.Rows[0].Cells[3].Controls[0]).Text;
cmd.Parameters.Add("@Rate", SqlDbType.Int).Value = ((TextBox)GridView1.Rows[0].Cells[4].Controls[0]).Text;
cmd.Connection = conn;
conn.Open();
cmd.ExecuteNonQuery();
And it is showing error the name GridView1 does not exist in the current context.I have added these refrences SQLHelper.cs class--
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts
;
whats missing guys?....
can anyone help.plz
Thanks
Amit