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;
namespace WindowsFormsApplication1
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (IsvalidUser(txtUser.Text, txtPassw.Text))
{
Form1 F = new Form1();
F.Show();
}
}
private bool IsvalidUser(string userName, string password)
{
DataClasses1DataContext context = new DataClasses1DataContext();
var q = from p in context.logintbs
where p.name == txtUser.Text
&& p.passw == txtPassw.Text
select p;
if (q.Any())
{
return true;
}
else
{
return false;
}
}
}
}