Users Pricing

forum

Home Forums The SelectCommand property has not been initialized before calling “Fill – MindStick

The SelectCommand property has not been initialized before calling “Fill

Anonymous User 3368 19 Jun 2013

The SelectCommand property has not been initialized before calling “Fill

My line of code as following

SqlConnection cn = new SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\MANTHAN\Documents\Visual Studio 2010\WebSites\sample\App_Data\Database.mdf;Integrated Security=True;User Instance=True");
    SqlCommand cmd = new SqlCommand("SELECT * FROM stu1", cn);
    SqlDataAdapter adp = new SqlDataAdapter(cmd);

    DataSet ds = new DataSet();

    adp.Fill(ds);

    GridView1.DataSource = ds.Tables[0];

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md