locked
Cannot access SQL data from Web Developer 2010 Express RRS feed

  • Question

  • User1774957027 posted

      Hello,<o:p></o:p>

    I am a newbie to this form and new into the world of Web and Cloud Computing. I am currently studying and have been asked to install Visual Web Developer 2010 Express to my laptop. I installed the following<o:p></o:p>

    a) Microsoft Sql Server 2008 R2 (installed first)<o:p></o:p>

    b) Installed Visual Web Developer 2010 Express.<o:p></o:p>

    I created a new empty Website using  ASP.NET Web Site within WEB Developer 2010 Express.<o:p></o:p>

    I then created an App Data for my data base.<o:p></o:p>

    I could create table names and column names. However when i try to view the table command - I get an message saying - "Operation is not valid due to current state of Object.". I have carried couple of times to uninstall and re-install <o:p></o:p>

    a) SQL Server 2008 R2 ( Inc Service Pack 3)<o:p></o:p>

    b) Visual Web Developer 2010 express.<o:p></o:p>

    My OS is Windows 7 <o:p></o:p>

    I would really appreciate if any body could advise.  i couldn't  post snapshots of the error page.

    Please help...<o:p></o:p>

    Suchitra <o:p></o:p>

    Wednesday, September 4, 2013 6:31 AM

Answers

  • User-1454326058 posted

    Hi Suchiedu,

    Thanks for your post!

    According to your description, you are troubling with retrieve data from SQL DataBase.

    Do you use the method of ExecuteReader()?

    If so, please check the state of SqlConnection. The state of SqlConnection should keep opening while you using ExecuteReader() to retrieve data.

    Here is a simple sample below that may benefit you:

     using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MessageInfoConnectionString"].ConnectionString))
                {
                    SqlCommand cmd = new SqlCommand("select * from  EmptyDb", conn);
                    conn.Open();
                    SqlDataReader r = cmd.ExecuteReader();
                    while (r.NextResult())
                    {
                        //TODO
                        object s = r[1];
                    }
                    conn.Close();
                }

    If you still have the issue, please provide your code to me.

    Thanks

    Best Regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 5, 2013 3:59 AM