TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
RAMESH SAHU
NA
121
12.6k
how to use login form user MDIParent form
Dec 6 2016 8:41 AM
hi i m ramesh sahu i m develop on window application project in C#.Net i have taken MDIParent Form and menu bar Login Option i m unable to do logout ones login is active and how to do log out in mdiparent form
i want to show username who login in mdiparent form either on title bar or toolstrip menu
please help me sir
this is my code
private void LogIn_Btn_Click(object sender, EventArgs e)
{
if ((txtUId.Text != "") && (txtpwd.Text != ""))
{
SqlConnection con = new SqlConnection("Data Source=DESKTOP-ERCK15V;Initial Catalog=AnySoftDB;Integrated Security=True; User Id=sa; Password=123");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Login_Sp";
cmd.Parameters.AddWithValue("@UserId", this.txtUId.Text);
cmd.Parameters.AddWithValue("@Pwd", this.txtpwd.Text);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (dr.HasRows == true)
{
MessageBox.Show("Login Successfully Done");
this.MdiParent.Text = "Anyosoft " + " Welcome " + txtUId.Text;
Form fm = Application.OpenForms["Login"];
this.Visible = false;
}
}
if (dr.HasRows == false)
{ MessageBox.Show("Access Denied, password username mismatched"); }
}
else { MessageBox.Show("Enter username and password"); }
}
Reply
Answers (
2
)
Move files from one folder to another folder on FTP Server
could not understand lines of code after decompiling a dll