string constr = "server=localhost;Database=unity3d;User Id=root;password=root";
//建立连接的语句
//如果是本地数据库server为localhost,不是则输入server的地址
MySqlConnection mycon = new MySqlConnection(constr); //建立连接
mycon.Open();
string selstr1 = "select fengsu, kw from sudu ";
MySqlCommand myselect1 = new MySqlCommand(selstr1, mycon);
DataSet ds1 = new DataSet();
try
{
MySqlDataAdapter da1 = new MySqlDataAdapter(selstr1, mycon);
da1.Fill(ds1);
}
catch (Exception ee)
{
throw new Exception("SQL: " + selstr1 + "\n" + ee.Message.ToString());
}
mycon.Close();
for(int i=0;i<100;i++){
float x = float.Parse(ds1.Tables[0].Rows[i][0].ToString());
float y = float.Parse(ds1.Tables[0].Rows[i][1].ToString());
myWMGSeries.pointValues.Add(new Vector2(x,y));
}