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)
{
phContents.Controls.Clear();
DataTable DT = new DataTable();
OdbcCommand cmd;
OdbcConnection conn = new OdbcConnection(constr);
if (conn.State == ConnectionState.Closed)
{
conn.Open();
OdbcCommand sql = new OdbcCommand("SET CHARACTER SET `tis620`", conn);
sql.ExecuteNonQuery();
sql.Dispose();
}
I can't run this page. It said "The ConnectionString property has not been initialized" at conn.open()
can anyone help me please.I'm totally new to asp.net so any comment apreciated.