Click here to Skip to main content
16,011,482 members
Home / Discussions / C#
   

C#

 
GeneralRe: Why C# Builder build program faster and smaller than vs.net? Pin
Kevin McFarlane29-Jul-03 6:54
Kevin McFarlane29-Jul-03 6:54 
AnswerRe: Why C# Builder build program faster and smaller than vs.net? Pin
Kevin McFarlane29-Jul-03 6:50
Kevin McFarlane29-Jul-03 6:50 
GeneralRe: Why C# Builder build program faster and smaller than vs.net? Pin
EastDragon29-Jul-03 16:13
EastDragon29-Jul-03 16:13 
GeneralRe: Why C# Builder build program faster and smaller than vs.net? Pin
Kevin McFarlane31-Jul-03 0:15
Kevin McFarlane31-Jul-03 0:15 
GeneralWhy cannot dasm the release version app using vs.net 2003 Pin
EastDragon28-Jul-03 20:06
EastDragon28-Jul-03 20:06 
GeneralRe: Why cannot dasm the release version app using vs.net 2003 Pin
LongRange.Shooter29-Jul-03 8:12
LongRange.Shooter29-Jul-03 8:12 
GeneralRe: Checking for Errors Pin
Member 9628-Jul-03 18:48
Member 9628-Jul-03 18:48 
GeneralRe: Checking for Errors Pin
totig28-Jul-03 22:05
totig28-Jul-03 22:05 
I have a solution, it may not be the best, but I find it works. Say you have two input boxes, one for login, the other for password. What I did was set up a connection to the database, as usual, but, I made my query find all the usernames that matched the username inputed. If this fails, you know the username is invalid. Else, it will check the password, and you will know then if it is incorrect. Here is the code I used - try to use an error provider rather than the messagebox, but this should explain things a bit better.

string s = "Initial Catalog="+db+";Data Source="+srv+";UID="+uid+";pwd="+ps+"";
cnn.ConnectionString = s;
cnn.Open();

if(TxtUid.Text == Empty || TxtPass.Text == Empty)
{
MessageBox.Show("UserID or Password can not be left blank!","Login Fail",MessageBoxButtons.OK,MessageBoxIcon.Error);
TxtUid.Focus();
}
else
{
sda = new SqlDataAdapter("Select usrPassword, usrFullName from users where usrName = '"+ TxtUid.Text +"'",cnn);
ds = new DataSet();
sda.Fill(ds);
dt = ds.Tables[0];
if(dt.Rows.Count == 0)
{
MessageBox.Show("The username specified does not exist","Login Fail",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
else
{
dr = dt.Rows[0];
string pass = dr[0].ToString();
string name = dr[1].ToString();
if(TxtPass.Text == pass)
{
Current.Visible = false;
ApplicationData.userNameConst = TxtUid.Text;
ApplicationData.userNameFullConst = name;
frm.Show();

}
else
{
MessageBox.Show("Password does not match username '"+ TxtUid.Text +"'","Login Fail",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
GeneralRe: Checking for Errors Pin
Rocky Moore28-Jul-03 22:36
Rocky Moore28-Jul-03 22:36 
GeneralRe: Checking for Errors Pin
Rocky Moore29-Jul-03 0:25
Rocky Moore29-Jul-03 0:25 
QuestionMinimize a maximized window ? Pin
heelios28-Jul-03 17:34
heelios28-Jul-03 17:34 
AnswerRe: Minimize a maximized window ? Pin
LongRange.Shooter29-Jul-03 5:46
LongRange.Shooter29-Jul-03 5:46 
QuestionHow to run an .exe on computers that have no .Net Framework installed? Pin
lynnday28-Jul-03 17:27
lynnday28-Jul-03 17:27 
AnswerRe: How to run an .exe on computers that have no .Net Framework installed? Pin
J. Dunlap28-Jul-03 17:49
J. Dunlap28-Jul-03 17:49 
Generalparameter name from params Pin
Rbledwards28-Jul-03 11:07
Rbledwards28-Jul-03 11:07 
GeneralRe: parameter name from params Pin
Rbledwards28-Jul-03 11:28
Rbledwards28-Jul-03 11:28 
GeneralRe: parameter name from params Pin
David Stone28-Jul-03 12:37
sitebuilderDavid Stone28-Jul-03 12:37 
GeneralRe: parameter name from params Pin
J. Dunlap28-Jul-03 12:39
J. Dunlap28-Jul-03 12:39 
GeneralRe: parameter name from params Pin
Nick Seng28-Jul-03 17:22
Nick Seng28-Jul-03 17:22 
GeneralProcess Priority Pin
eggie528-Jul-03 10:51
eggie528-Jul-03 10:51 
GeneralRe: Process Priority Pin
Julian Bucknall [MSFT]28-Jul-03 11:51
Julian Bucknall [MSFT]28-Jul-03 11:51 
GeneralRe: Process Priority Pin
eggie528-Jul-03 11:58
eggie528-Jul-03 11:58 
GeneralRe: Process Priority Pin
David Stone28-Jul-03 12:28
sitebuilderDavid Stone28-Jul-03 12:28 
GeneralOT Pin
J. Dunlap28-Jul-03 12:17
J. Dunlap28-Jul-03 12:17 
GeneralEncrypting\Decrypting Pin
draco_iii28-Jul-03 9:39
draco_iii28-Jul-03 9:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.