Last post Apr 24, 2014 09:20 AM by bdhkrl
Apr 24, 2014 08:53 AM|bdhkrl|LINK
I am using Mysql database.
Inserting the values of the Checkbox list into into the mysql table is successful, but the below code for retrieving the data has encountered one problem.
The above line is showing error "The type or namespace MysqlDataReader could not be found."
I have already done the reference part for Mysql.Data, still getting the issue.
What could be the problem?
protected void Button2_Click(object sender, EventArgs e)
string connStr = "Server=localhost;Database=mysqldb;Uid=uid;Pwd=******$$;";
string intersts = "";
using (MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection(connStr))
MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand();
cmd.Connection = conn;
// SqlCommand cmd = new SqlCommand("Select Interests from Demo", cn); // Write your Query i have taken as sample
cmd.CommandText = "Select areas from area_of_interests ";
dr = cmd.ExecuteReader();
intersts = dr["Interests"].ToString();
string arr = intersts.Split(',');
foreach (ListItem item in this.CheckBoxList1.Items)
foreach (string s in arr)
if (item.Text == s)
item.Selected = true;
kindly suggest a solution.
Apr 24, 2014 09:15 AM|AidyF|LINK
.net is case-sensitive.
Apr 24, 2014 09:20 AM|bdhkrl|LINK
In the code its MysqlDataReader only (as suggested by you).
It was an issue with adding reference.
Issue is resolved now. The code works.
Thanks for your time.