-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Sharath Paleri
Message 1 in Discussion

 Hi,
I am trying to access a Microsoft Access DB.. while the 
commandobject.ExecutNonQuery there is return value of zero.. which means no 
records have met my search criteria. I dont know if i am making a mistake.. 
please do check my code given below.. Any help would be kind..

string connectionString=@"C:\Documents and Settings\shrath1\My Documents\Visual 
Studio 2005\ WebSites\ConfiguringAccessDb\App_Data\IssueTrackingSystem.mdb";

OleDbConnection oleconn = new 
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + 
connectionString);

OleDbCommand olecomm=null; OleDbDataAdapter oledbDataAdapter; DataSet ds=null;

string commandText = "SELECT USERNAME,PASSWORD FROM LOGIN WHERE USERNAME = '" + 
Login1.UserName + "'" + " " + "and password='" + Login1.Password + "'"; //= ? 
AND PASSWORD = ?"; 

olecomm = new OleDbCommand(commandText, oleconn);  
//olecomm.Parameters.Add(new OleDbParameter("@UserName",this.Login1.UserName)); 
//olecomm.Parameters.Add( new OleDbParameter("@Password",this.Login1.Password));

try
{
oleconn.Open();
int count = olecomm.ExecuteNonQuery();
if (count > 0 & count == 1)
{
Login1.Visible = false;
}
else
{
Login1.FailureText = "Login Failed,Please try again";
}
}
catch (InvalidOperationException ie)
{
Login1.FailureText = "Sorry for the Inconvnience";
} 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to