Click here to Skip to main content
15,896,496 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void ReadRecords()
        {
            OleDbConnection conn = null;
            OleDbDataReader reader = null;

            try
            {
            
                conn.Open();

                OleDbCommand cmd = new OleDbCommand("Select * FROM nifty_daily", conn);
                reader = cmd.ExecuteReader();

                datagrid.DataSource = reader;
                datagrid.DataBind();
            }

            finally
            {
                if (reader != null) reader.Close();
                if (conn != null) conn.Close();
            }
        }
    }

I got error at datagrid
Posted
Updated 26-Feb-15 21:53pm
v2

1 solution

Error says it all !
Your gridview/datagrid control Id seems to different than "datagrid".
Check the source page(.aspx) for the correct Id.

Hope, that helps :)
 
Share this answer
 

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

  Print Answers RSS


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