public partial class Main_Activity : System.Web.UI.Page
    private string constr = ConfigurationManager.AppSettings.Get("constr");
    protected void Page_Load(object sender, EventArgs e)
        if (Request.QueryString["cid"] != null) { loadData(Convert.ToString(Request.QueryString["cid"])); }
        else { loadData("all"); }

    private void loadData(string catId)
        DataTable DT = new DataTable();
        OdbcCommand cmd;
        OdbcConnection conn = new OdbcConnection(constr);
        if (conn.State == ConnectionState.Closed)
            OdbcCommand sql = new OdbcCommand("SET CHARACTER SET `tis620`", conn);

I can't run this page. It said "The ConnectionString property has not been initialized" at
can anyone help me please.I'm totally new to so any comment apreciated.

Double check what your constr is holding after your have created it.

You need to save the connection strings under <connectionString/> section and read it using System.Configuration.ConfigurationManager.ConnectionString["CnStr_Name"].ConnectionString.

     <add name="CnStr" 

Hi please am a new member here, i came across this site while i was looking for help. Am working on a new web site on visula studio c sharp and i have one text field to select a data from the database. Please how do i connect the text field to database and how do i write the selection command.

Firstly you start a new thread (button at the top of the page) so you're not hijacking someone else's, its considered impolite. Then we help you:)

To clarify since Aviplo indicated he was new to, the connection string section that adatapost was referring to is located in the web.config file.