日期:2014-05-16 浏览次数:20801 次
string connStr = String.Format("server=127.0.0.1;user id=root; database=test; pooling=false;port=3306"); MySqlConnection myConn = new MySqlConnection(connStr); myConn.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = myConn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "pre_name"; MySqlParameter ind = new MySqlParameter("?index_name", MySqlDbType.Int16, 15); ind.Value=1; cmd.Parameters.Add(ind); MySqlParameter id = new MySqlParameter("?",MySqlDbType.VarChar,40); id.Direction = ParameterDirection.Output; cmd.Parameters.Add(id); cmd.ExecuteNonQuery(); textBox4.Text = id.Value.ToString(); myConn.Close();