c#客户端读写阿里云数据库总是失败
try {
conn.Open();//打开通道,建立连接
MessageBox.Show("数据库连接");
//搜索手机号
MySqlCommand comm = new MySqlCommand("select * from yh1 where num1=158", conn);
MySqlDataReader reader = comm.ExecuteReader();
MessageBox.Show("查了");
conn.Close();
bool hr = reader.HasRows;
if (reader.HasRows)
{ MessageBox.Show(hr.ToString()); }
//没有手机号,注册
else
{ MessageBox.Show(hr.ToString()); }
string wre = string.Format("insert yh1(num1) values('151')");
conn.Open();
//
MySqlCommand zhuce= new MySqlCommand(wre, conn);
zhuce.ExecuteNonQuery();
MessageBox.Show("kaile");
conn.Close();
}
catch
{ MessageBox.Show("写入失败");
}