any help would be great thank you. not sure why its all ways returning a null I'm not sure if its even connecting to the database.
my web config file
<configuration>
<connectionStrings>
<add name="accessConnectionString" providerName="Microsoft.Jet.OLEDB.4.0" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\***\Desktop\pratice\AccessTest\App_Data\TheList.mdb;Persist Security Info=True"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
</configuration>
middle tier code to check if user is in the database if they are return something if not return null
OleDbConnection sconn = new OleDbConnection();
OleDbCommand scmd = new OleDbCommand();
public DBMiddleTier()
{
try
{
// set up the connection strings
sconn.ConnectionString = ConfigurationManager.ConnectionStrings["accessConnectionString"].ToString();
}
catch(Exception ex)
{
throw ex;
}
}//end of constructor
//class to check membership
public object checkMembership(string logid, string password)
{
try
{
sconn.Open();
//set propertiers of the command
scmd.Connection = sconn;
scmd.CommandType = CommandType.Text;
scmd.CommandText = "select * from SubDealers where LoginID = @InputUsername and Password = @InputPassword";
scmd.Parameters.Clear();
OleDbParameter checkUsername = scmd.Parameters.Add("@InputUsername", OleDbType.VarChar, 50);
checkUsername.Value = logid;
OleDbParameter checkPassword = scmd.Parameters.Add("@InputPassword", OleDbType.VarChar, 50);
checkPassword.Value = password;
object result = scmd.ExecuteScalar();
return result;
}
catch (OleDbException sqx)
{
throw sqx;
}
finally
{
sconn.Close();
}
}//end of method
my code behind page
try
{
object result = dm.checkMembership(txtLoginID.Text, txtPassword.Text);
if (result != null)
{
Response.Redirect("https://www.google.com/");
}
else
{
txtLoginID.Text = "";
txtPassword.Text = "";
Page.ClientScript.RegisterStartupScript(this.GetType(), "notAmember", "alert('Sorry wrong id or password');", true);
}
}
catch (Exception ex)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + ex.Message + "');", true);
}