1
入力したユーザー名がデータベースに既に存在するかどうかを確認しようとしています。しかし、上記のエラーは上昇する。コマンド実行中に致命的なエラーが発生しました
protected void txtUsername_TextChanged(object sender, EventArgs e)
{
MySqlConnection con = new MySqlConnection(con1);
try{
if (!string.IsNullOrEmpty(txtUsername.Text))
{
con.Open();
MySqlCommand cmd = new MySqlCommand("select username from client_login where [email protected]", con);
DataSet ds = new DataSet();
MySqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
checkusername.Visible = true;
imgstatus.ImageUrl = "NotAvailable.jpg";
lblStatus.Text = "UserName Already Taken";
}
else
{
checkusername.Visible = true;
imgstatus.ImageUrl = "Icon_Available.gif";
lblStatus.Text = "UserName Available";
}
}
else
{
checkusername.Visible = false;
}
con.Close();
}
catch(Exception ex){
Response.Write(ex);
}
}
テキストボックスおよびテキストボックスにコードエラーがでは ベース=としてリーダーを実行している
` <asp:TextBox ID="txtUsername" runat="server" AutoPostBack="true" OnTextChanged="txtUsername_TextChanged"></asp:TextBox>`
下にある{「コマンドの実行中に発生した致命的なエラー。」}
stacktraceを追加します。 – Guy
stackTraceは生成されません –