ظاهرا خط کامنتکسن خطا داره
اینو ببین
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 System.Data.SqlClient;

namespace CheckUserNameAndPassword
{
public partial class Form1 : Form
{
private SqlConnection objconnection = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\Dbase_UP.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
private SqlCommand objcommand;

public Form1()
{
InitializeComponent();
}

private void btnLogin_Click(object sender, EventArgs e)
{
int i = 0;
try
{

if ((txtUserName.Text == string.Empty) || (txtPassword.Text == string.Empty))
{
MessageBox.Show("Enter Data !");
return;
}

objcommand = new SqlCommand("SELECT COUNT(*) FROM Tbl_Users " +
"WHERE UserName=@UserName AND Password=@Password", objconnection);

objcommand.Parameters.AddWithValue("@UserName", txtUserName.Text.ToString());
objcommand.Parameters.AddWithValue("@Password", txtPassword.Text.ToString());

if (objconnection.State == ConnectionState.Closed)
{
objconnection.Open();
i =(int) objcommand.ExecuteScalar();
}//end if

objconnection.Close();

if (i > 0)
{
Form2 frm2 = new Form2();
frm2.Show();
}
else
MessageBox.Show("No Authentication !");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
i = 0;
objconnection.Close();
}
}
}
}