我有以下代码验证从SQL Server检索到的用户ID和密码,但是我希望密码的验证区分大小写。
Dim frm As New MarksEntryFrm
Dim flag As Boolean
flag = False
cmd = New SqlCommand("Select a.Form,a.AcademicYear,b.SubjectID,b.UserID,b.Password,c.Term from StudentDetails.Programmes a, StudentDetails.Subjects b,RegistrationDetails.Registration c where b.SubjectID='" & cboSubjCode.SelectedItem & "' and b.UserID='" & txtUserName.Text & "' and b.Password='" & txtPassword.Text & "'", cn)
dr1 = cmd.ExecuteReader
ctr = ctr + 1
If dr1.Read Then
frm.Show()
ctr = 0
Me.Hide()
ElseIf ctr < 3 Then
MessageBox.Show("Incorrect Subject Code,User Name or Password. Please try again.", "Wrong data entered", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
Else …Run Code Online (Sandbox Code Playgroud) 给定a = 1,b = 5和c = 6的值,x的值应该是-2和-3,但是下面的程序给出x的值为6和-11,这是不正确的.如果有人能弄清楚该计划有什么问题,我将不胜感激.
#include<iostream.h>
#include<conio.h>
int main()
{
char reply;
int a,b,c,q,z;
do
{
cout<<"Enter the value of a: ";
cin>>a;
cout<<"\nEnter the value of b: ";
cin>>b;
cout<<"\nEnter the value of c: ";
cin>>c;
q=(-b-(b*b-4*a*c)sqrt(b))/2/a;
z=(-b+(b*b-4*a*c)sqrt(b))/2/a;
cout<<"\nThe values of x are "<<q<<" and "<<z;
cout<<"\nDo you want to find another values of x(y/n)?";
cin>>reply;
}
while(reply=='y');
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)