Server Error in '/Login' Application.
Column 'CompanyName' does not belong to table Table.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Column 'CompanyName' does not belong to table Table.
Source Error:
Line 40: }
Line 41:
Line 42: else if (ds.Tables[0].Rows[i]["CompanyName"].ToString() == "Riyas")
Line 43: {
Line 44: if ((User == ds.Tables[0].Rows[i]["UserName"].ToString()) && (Pass == ds.Tables[0].Rows[i]["Password"].ToString()))
|
Source File: d:\selvi\Login\Login.aspx.cs Line: 42
public partial class Login : System.Web.UI.Page
{
DataSet ds = new DataSet();
DataSet dss = new DataSet();
Marvel mar = new Marvel();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void img_Click1(object sender, ImageClickEventArgs e)
{
string User = txtusername.Text;
string Pass = txtpassword.Text;
string qry = "select UserName,Password from Account where CompanyName='"+DropDownList1.SelectedItem.Text.ToString()+"'";
ds = mar.GETDS(qry);
if (ds.Tables[0].Rows != null)
{
for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
{
if ((User == ds.Tables[0].Rows[i]["UserName"].ToString()) && (Pass == ds.Tables[0].Rows[i]["Password"].ToString()) && (ds.Tables[0].Rows[i]["CompanyName"].ToString() == "Birmandam"))
{
Response.Redirect("~/Admin/Report.aspx");
}
else if (ds.Tables[0].Rows[i]["CompanyName"].ToString() == "Riyas")
{
if ((User == ds.Tables[0].Rows[i]["UserName"].ToString()) && (Pass == ds.Tables[0].Rows[i]["Password"].ToString()))
Response.Redirect("ForgotPassword.aspx");
}
else if (ds.Tables[0].Rows[i]["CompanyName"].ToString() == "Saravanas")
{
if ((User == ds.Tables[0].Rows[i]["UserName"].ToString()) && (Pass == ds.Tables[0].Rows[i]["Password"].ToString()))
Response.Redirect("Stockentry.aspx");
}
else
{
label.Text = "UserName/Password is Incorrect";
}
}
}
}
protected void LinkButton1_Click1(object sender, EventArgs e)
{
Response.Redirect("ForgotPassword.aspx");
}
}