如题:MySQLConnection con = new MySQLConnection( new MySQLConnectionString("localhost","beephpcms","root","root").AsString);
try
{
DataSet ds = new DataSet();
con.Open();
MySQLCommand cmd = new MySQLCommand("set names 'gb2312'", con);
cmd.ExecuteNonQuery();
MySQLCommand com = new MySQLCommand("select contentid as id,content from phpcms_c_news where content like '%news_%html%'", con);
MySQLDataReader mydr = com.ExecuteReaderEx();
while (mydr.Read())
{
string content = "";
string id = "";
id = mydr["id"].ToString();
content=mydr["content"].ToString();//此行报错,content是mediumtext类型数据
}
mydr.Close();
con.Close();
}
catch (Exception error)
{
MessageBox.Show(error.Message);
}请指点如何读取mediumtext类型数据
try
{
DataSet ds = new DataSet();
con.Open();
MySQLCommand cmd = new MySQLCommand("set names 'gb2312'", con);
cmd.ExecuteNonQuery();
MySQLCommand com = new MySQLCommand("select contentid as id,content from phpcms_c_news where content like '%news_%html%'", con);
MySQLDataReader mydr = com.ExecuteReaderEx();
while (mydr.Read())
{
string content = "";
string id = "";
id = mydr["id"].ToString();
content=mydr["content"].ToString();//此行报错,content是mediumtext类型数据
}
mydr.Close();
con.Close();
}
catch (Exception error)
{
MessageBox.Show(error.Message);
}请指点如何读取mediumtext类型数据
string strcont = System.Text.Encoding.Default.GetString(content);