How to simply check authentication using C# microframework PetaPoco

string username =””;
string password =””;
username = txtUsername.Text;
password = txtPassword.Text;

var db = new PetaPoco.Database(“accessConnectionString”);
var result = db.Fetch<WindowsFormsApplication1.Entities.admin>(“select *from admin where username=@0 and password =@1 “,username,password);
int loginsuccess = 0;
loginsuccess = result.Count;

if (loginsuccess > 0)
{

MessageBox.Show(“Login Successfull “);
dashboard d = new dashboard();
d.Show();
this.Hide();
}
else
{
MessageBox.Show(“Invalid Login”);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s