last day (15 days later) » 

9:19 AM
0
A: C# loading the main form after successful login

Syed Farjad Zia ZaidiThis is because you are doing it wrong, 1.) This is the Constructor for the Form1 and this code is executed whenever the form is created, so you are displaying your FrmLogin form as soon as you show your Form1. public Form1() { FrmLogin frm = new FrmLogin(); frm.ShowDialog(); Initia...

 
Syed Thanks for replying.But I dont want to use hide method...I want that the Login form should close.So this.close() would work in place of this.hide()?
 
@user2614235 I have updated the answer. @jmcilhinney I was not using the DialogResult first, I was just simply checking the credentials and based on that display the other form and hide the first one, I have changed the answer to use DialogResult now...
 
@SyedFarjadZiaZaidi Thanks once again.But I am a bit confused..Wait ill update my question with the complete Login Form code
 
@user2614235 I have updated the answer, please select it as answer if it solves your problem...
 
@SyedFarjadZiaZaidi I am getting please enter correct credentials and try again even after entering the correct credentials.What is to be done?
 
9:19 AM
This is because you are entering wrong username and password....
 
nope I am entering the correct username and password that exists in the table. Do you want to take a look at the stored procedure?
Hi Hope m not disturbing you..It is always throwing the same message even after entering correct credentials
 
9:37 AM
you there?
I have to go now, lets just add the stored procedure in the question I will check it tonight
Thank you
 
Ya sure no problem
I added the stored procedure
 
 
7 hours later…
4:40 PM
@user2614235
@user2614235 Are you there? I think the code is working fine, first try executing the stored procedure using the SQL Server Management Studio or Visual Studio Query executor, if the stored procedure is working fine then debug your problem and then proceed step by step checking what is being returned from the stored procedure and if it's the value we want or not,
 

  last day (15 days later) »