my design is
<%@ Page Language="C#" MasterPageFile="~/MasterPage/cloth.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" Title="Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style2
{
height: 18px;
}
</style>
</asp:Content>
<asp:Content ID="Content3" runat="server"
contentplaceholderid="ContentPlaceHolder1">
</asp:Content>
<asp:Content ID="Content4" runat="server"
contentplaceholderid="FullContentArea">
</asp:Content>
<asp:Content ID="Content5" runat="server" contentplaceholderid="Header_Menu">
<ul id="nav">
<%-- <li ><a href="index.html">Home</a></li>--%>
<%--<li><a href="Login.aspx">Login</a></li> --%>
<li><a href="contactus.aspx" style="font-size:xx-large;font-style:normal;font-weight:lighter">Main</a></li>
</ul>
</asp:Content>
<asp:Content ID="Content6" runat="server" contentplaceholderid="ContentReport">
<form id="form1" runat="server">
<script type="text/javascript" language="javascript">
function ChangeBackground()
{
window.event.srcElement.style.background = " #1d599e";
}
function RestoreBackground()
{
window.event.srcElement.style.background = "#FFFFFF";
}
</script>
<script type="text/javascript" language="javascript">
function Account()
{
if(document.getElementById('ctl00_ContentReport_txtusername').value == "")
{
alert("Enter Username");
document.getElementById('ctl00_ContentReport_txtusername').focus();
return false;
}
if(document.getElementById('ctl00_ContentReport_txtpassword').value == "")
{
alert("Enter Password");
document.getElementById('ctl00_ContentReport_txtpassword').focus();
return false;
}
return true;
}
</script>
<table width="50%" align="center" style="border-color: #1d599e; border-style: outset;
border-width: thin;" >
<tr>
<td style="margin-left: 80px; background:#1d599e;" colspan="2" align="center">
<asp:Label ID="Label22" runat="server" Text="LOGIN" Style="color: #FFFFFF;
font-size: 12px; font-weight: 700; text-align: center;" class="style10"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Company Name" Height="15px" style="font-weight: 700; font-size: 11px; font-family: Arial, Helvetica, sans-serif"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="134px"
AutoPostBack="True">
<asp:ListItem>Select</asp:ListItem>
<asp:ListItem>Birmandam</asp:ListItem>
<asp:ListItem>Riyas</asp:ListItem>
<asp:ListItem>Saravanas</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td >
<asp:Label ID="Label20" runat="server" Text="UserName" Height="15px" style="font-weight: 700; font-size: 11px; font-family: Arial, Helvetica, sans-serif"></asp:Label>
</td>
<td class="style2">
<asp:TextBox ID="txtusername" runat="server" Height="15px"
onmouseover="ChangeBackground();"
onmouseout="RestoreBackground();" ForeColor="#acacac" Width="130px"></asp:TextBox>
</td>
</tr>
<tr>
<td >
<asp:Label ID="Label21" runat="server" Text="Password" Height="15px"
style="font-weight: 700; font-size: 11px; font-family: Arial, Helvetica, sans-serif"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtpassword" runat="server"
onmouseover="ChangeBackground();"
onmouseout="RestoreBackground();" ForeColor="#acacac"
Height="15px" TextMode="Password" Width="130px"></asp:TextBox>
</td>
</tr>
<tr align="center">
<td colspan="2">
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click1">Forgot Password <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/Forgotten-Password.jpg" /></asp:LinkButton>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:ImageButton ID="img" ImageUrl="~/Images/login_button_01.jpg" runat="server" OnClientClick=" return RegainFocus()"
Width="90px" onclick="img_Click1" />
<br />
<asp:Label ID="label" runat="server" style="font-weight: 700; color: #666666"></asp:Label>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<br />
</td>
</tr>
</table>
</form>
</asp:Content>
my code is
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
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");
}
}
it throws this error
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