Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 16th, 2007, 05:00 AM
Registered User
 
Join Date: Feb 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default help

I am getting this Exception:
System.InvalidOperationException: The ConnectionString property has not been initialized.


code:
private void bindData()
        {

            dbcon objDbCon=new dbcon();
            DataSet ds=new DataSet();
            string sql;

            if (ViewState["sortfield"]!=null)
                sql="select * from [product details] where category_id=" + catid + " order by " + ViewState["sortfield"].ToString();
            else
                sql="select * from [product details] where category_id=" + catid;
            objDbCon.getData(sql, ref ds,"[product details]");
            objDbCon.dispose();
            objDbCon=null;
            if (ds.Tables["[product details]"].Rows.Count>0)
            {
                grdItemlist.DataSource=ds;
                grdItemlist.DataMember="[product details]";
                grdItemlist.PageSize=5;
                grdItemlist.DataBind();
            }
            else
            {
                Errmsg.Text="No items in this category";

            }

        }

 
Old February 19th, 2007, 10:20 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What is your question? Obviously you are not setting the connection string in your object. Since you did not post the releveant code, we can't help you. Check your dbcon object.

 
Old February 19th, 2007, 10:23 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Cross post. Source thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=56367

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html

Discussion:
http://p2p.wrox.com/topic.asp?TOPIC_ID=56429









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.