Home > Net >  After the show must declare the scalar variable "@".
After the show must declare the scalar variable "@".

Time:09-17

SqlCommand MCM=new SqlCommand (@ "SELECT [F_Account]
, [F_Password]
The FROM [LR_Base_User] WHERE [F_Account]=@ [F_Account] AND [F_Password]=@ [F_Password] ", MCQ);
SqlParameter p1=new SqlParameter (" @ F_Account, "textUserName. Text);
SqlParameter p2=new SqlParameter (" @ F_Password, "textUserPass. Text);
MCM. The Parameters. The Add (p1);
MCM. The Parameters. The Add (p2);
SqlDataReader mydr=MCM. ExecuteReader (); \ \ must declare the scalar variable "@" will be displayed after launch,
The DataTable mydt=new DataTable ();
Mydt. Load (mydr);
Mydr. Close ();
MCQ. Close ();
If (mydt. Rows. Count & gt; 1)
{
Xiansi. Text="login successfully!" ;
FrmMain FM=new FrmMain ();
FM. The Show ();
This. Hide ();
}
The else
{
MessageBox. Show (" check ");
}
}

CodePudding user response:

@ / F_Account ] @ / F_Password ] the two brackets is removed
  •  Tags:  
  • C#
  • Related