0

Hi,

im trying to set a row filter based one fixed paramater (locationID) and a second paramater on a session variable - im not an expert in C# at all, but i think what i have done should work? Can anyone see anything wrong / offer suggestions please? :)

try
        {

            connection.Open();

            string sqlStatement = "SELECT * FROM SI";

            SqlCommand sqlCmd = new SqlCommand(sqlStatement, connection);

            SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
            
            sqlDa.Fill(dt);
            
            string pID = Convert.ToString("Session[pageId]");
                       
            if (dt.Rows.Count > 0)
            {

                DataView dv = new DataView(dt); 
                dv.RowFilter = "locatID = 1, PageId =" + pID + "";
                GridView1.DataSource = dv;
                GridView1.DataBind();
                dv.RowFilter = "locatID = 2, PageId =" + pID + "";
                GridView2.DataSource = dv;
                GridView2.DataBind();
                dv.RowFilter = "locatID = 3, PageId =" + pID + "";
                GridView3.DataSource = dv;
                GridView3.DataBind();


            }

any help would be most appreciated :)

thanks

3
Contributors
3
Replies
6
Views
7 Years
Discussion Span
Last Post by foluis
0

btw i keep getting the error "Syntax Error Exception was unhandled by user code"

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.