Click here to Skip to main content
15,886,105 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
I am creating application for a clinic and need to create login with privileges. either already say I've now only need to give the privileges but I do not see how to do. someone help me

C#
<big>//Login Form</big>
namespace GESTAO_CLINICA
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
            txtsenha.PasswordChar = '*';
        }

        <big>//Button Save</big>
        private void button2_Click(object sender, EventArgs e)
        {
           
            try
           {
                string sql="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=db_Maried;Data Source=TOBE-ANGOLA-PC";
                SqlConnection conn=new SqlConnection (sql);

                SqlCommand cmd = new SqlCommand("select UserName,Senha,TipoConta from tb_login where UserName='" + this.txtUsuario.Text + "'and Senha ='" + this.txtsenha.Text + "' ;", conn);
                SqlDataReader leitura;
                conn.Open();
                leitura = cmd.ExecuteReader();
                int count = 0;
                while (leitura.Read())
                {
                    count = count + 1;
                }
                if (count == 1)
                {

                    this.Hide();
                    Form1 c = new Form1(txtUsuario.Text); //Principal Form (Desktop)
                    c.ShowDialog();


                }
                else if (count > 1)
                {
                    //MessageBox.Show("Usuario ou senha Duplicada....Acesso Negado");
                    label3.Visible = true;

                    label3.Text = "Usuario ou senha Duplicada....Acesso Negado";
                }
                else
                {
                    //MessageBox.Show ("Usuario ou senha Errada....Por Favor Tente de Novo");
                    label3.Visible = true;
                    label3.Text = "Usuario ou senha Errada....Por Favor Tente de Novo";
                }
                conn.Close();
           }
            catch (Exception ex)
            {
                MessageBox.Show("Erro", ex.Message);
            }

        }
Posted

1 solution

to resolve your question,i suggest you to set your manifest file.please see:http://msdn.microsoft.com/en-us/library/bb756929.aspx

regarding LDAP,i recommended that you can refer the following KB.
http://support.microsoft.com/default.aspx?scid=kb;en-us;316748
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900