if (this.textBox1.Text == "")
{
MessageBox.Show("你没搞错吧?");
}
else
{
MySqlConnection myConnection = new MySqlConnection("server=localhost;user id=root;password=;database=account");
string query = "select * from account where Name = ?Name";
MySqlCommand myCommand = new MySqlCommand(query, myConnection);
myCommand.Parameters.Add("?Name",MySqlDbType.VarChar,32);
myCommand.Parameters["?Name"].Value =this.textBox1.Text;
myConnection.Open();
myCommand.ExecuteNonQuery();
MySqlDataReader myDataReader = myCommand.ExecuteReader();
string lblIdView = "";
if (myDataReader.Read() == true)
{
lblIdView += myDataReader["id"];
this.lblIdView.Text = lblIdView;
myConnection.Close();
MySqlConnection myConnection2 = new MySqlConnection("server=localhost;user id=root;password=;database=my");
string query2 = "select * from cq_user where id = ?id";
MySqlCommand myCommand2 = new MySqlCommand(query2, myConnection2);
myCommand2.Parameters.Add("?id", MySqlDbType.Int16);
myCommand2.Parameters["?id"].Value = myDataReader["id"];
myConnection2.Open();
myCommand2.ExecuteNonQuery();
MySqlDataReader myDataReader2 = myCommand.ExecuteReader();
string lblMainNameView = "";
string lblLevelView = "";
string lblMSView = "";
lblMainNameView += myDataReader2["name"];
this.lblMainNameView.Text = lblMainNameView;
lblLevelView += myDataReader2["level"];
this.lblLevelView.Text = lblLevelView;
lblMSView += myDataReader2["emoney"];
this.lblMSView.Text = lblMSView;
myDataReader2.Close();
myConnection2.Close();
}
else
{
MessageBox.Show("你没搞错吧?");
}
}
{
MessageBox.Show("你没搞错吧?");
}
else
{
MySqlConnection myConnection = new MySqlConnection("server=localhost;user id=root;password=;database=account");
string query = "select * from account where Name = ?Name";
MySqlCommand myCommand = new MySqlCommand(query, myConnection);
myCommand.Parameters.Add("?Name",MySqlDbType.VarChar,32);
myCommand.Parameters["?Name"].Value =this.textBox1.Text;
myConnection.Open();
myCommand.ExecuteNonQuery();
MySqlDataReader myDataReader = myCommand.ExecuteReader();
string lblIdView = "";
if (myDataReader.Read() == true)
{
lblIdView += myDataReader["id"];
this.lblIdView.Text = lblIdView;
myConnection.Close();
MySqlConnection myConnection2 = new MySqlConnection("server=localhost;user id=root;password=;database=my");
string query2 = "select * from cq_user where id = ?id";
MySqlCommand myCommand2 = new MySqlCommand(query2, myConnection2);
myCommand2.Parameters.Add("?id", MySqlDbType.Int16);
myCommand2.Parameters["?id"].Value = myDataReader["id"];
myConnection2.Open();
myCommand2.ExecuteNonQuery();
MySqlDataReader myDataReader2 = myCommand.ExecuteReader();
string lblMainNameView = "";
string lblLevelView = "";
string lblMSView = "";
lblMainNameView += myDataReader2["name"];
this.lblMainNameView.Text = lblMainNameView;
lblLevelView += myDataReader2["level"];
this.lblLevelView.Text = lblLevelView;
lblMSView += myDataReader2["emoney"];
this.lblMSView.Text = lblMSView;
myDataReader2.Close();
myConnection2.Close();
}
else
{
MessageBox.Show("你没搞错吧?");
}
}
这个异常怎么处理`?
两个数据库的联查`.