using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.IO;
using System.Configuration;
namespace Login
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
private void btnLogin_Click(object sender, EventArgs e)
{
try
{
using (MySqlConnection ObjCon = new MySqlConnection(new Common().GetConnectionString()))
{
ObjCon.Open();
DataSet ds = new DataSet();
using (MySqlCommand ObjCmd = new MySqlCommand("SP_TBL_SM_Login", ObjCon))
{
ObjCmd.CommandType=CommandType.StoredProcedure;
ObjCmd.Parameters.Add("@UserName",MySqlDbType.VarChar,8).Value=txtUserName.Text.Trim();
ObjCmd.Parameters.Add("@Password",MySqlDbType.VarChar,8).Value=txtPassword.Text.Trim();
MySqlDataAdapter ada = new MySqlDataAdapter(ObjCmd);
ada.Fill(ds,"Login");
if (ds.Tables["Login"].Rows.Count > 0)
{
Menu M = new Menu();
M.ShowDialog();
}
else
MessageBox.Show("InValid UserName And Password!!!");
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
No comments:
Post a Comment