概述
protectedvoidButton1_Click(objectsender,EventArgse){stringSqlStr="DataSource=127.0.0.1;UserId=root;Password=123;DataBase=website2;";MySqlConnectioncon=newMySqlConnection(...
protected void Button1_Click(object sender, EventArgs e)
{
string SqlStr = "Data Source=127.0.0.1;User Id=root;Password=123;DataBase=website2;";
MySqlConnection con = new MySqlConnection(SqlStr);
MySqlDataAdapter username = new MySqlDataAdapter();
MySqlDataAdapter password = new MySqlDataAdapter();
username.SelectCommand = new MySqlCommand("select username from user",con);
password.SelectCommand = new MySqlCommand("select password from user", con);
DataSet un = new DataSet();
DataSet pd = new DataSet();
password.Fill(pd);
username.Fill(un);
username.SelectCommand = new MySqlCommand("select count(*) from user", con);
DataSet count = new DataSet();
username.Fill(count);
for (int i = 0; i < Convert.ToInt32(count.Tables[0].Rows[0][0]); i = i + 1)
{
int g = 0;
if (this.TextBox1.Text.Equals(un.Tables[0].Rows[g]["username"]) && this.TextBox2.Text.Equals(pd.Tables[0].Rows[g]["password"]))
{
Response.Redirect("welcome.aspx?Name="+this.TextBox1.Text);
break;
}
else
{
Response.Write("");
}
g=g+1;
}
con.Close();
}
展开
最后
以上就是淡然星月为你收集整理的mysql不要最后一行数据_为什么这里读不出数据库最后一行的数据?的全部内容,希望文章能够帮你解决mysql不要最后一行数据_为什么这里读不出数据库最后一行的数据?所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复