Click here to Skip to main content
15,915,611 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have create aspx page like that inside the table

XML
<tr>
                <td>
                    <asp:Label ID="lblusername" runat="server" Text="Username"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtusername" MaxLength="20" runat="server"></asp:TextBox>
                </td>
                         
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblpassword" runat="server" Text="Password"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtpassword" MaxLength="30" TextMode="Password" runat="server"></asp:TextBox>
                </td>
            </tr>


then in default.aspx.cs what is the code by using stored procedure

C#
protected void btnsignIn_Click(object sender, EventArgs e)
    {
         what will the code to compare username and password using stored procedure
    }
Posted

In stored procedure pass username and password then make select query like

SQL
Select * from table where username=@uname and password=@pwd


for executing the query programatically Check this[^]
 
Share this answer
 
v2
Comments
vivekx2 14-Feb-12 8:45am    
thank u....I already created this...But how to call stored procedure in App_Code/Class1.cs file
Syed Salman Raza Zaidi 15-Feb-12 2:32am    
You've to use Database Connectivity, check this link for this purpose
http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson07.aspx
Just pass parameter as your user name and password to your store procedure..

and make store procedure like this...

SQL
select * from "tablename" where username = @usernam and password = @password


if this query return something or return any row then your user will valid else not valid...

call that procedure using your code and pass your text boxes value respectively and see the result of your procedure for validation
 
Share this answer
 
v2
Comments
vivekx2 14-Feb-12 9:03am    
I created my stored procedure as
Create proc sp_check
@username varchar(20),
@password varchar(20)
as
begin
Select count(*) from name
where username =@username and password =@password
end

But in cs file how do we pass parameter for this stored procedure....can you explain with code
Tejas Vaishnav 16-Feb-12 2:00am    
Da.SelectCommand = new SqlCommand();
Da.SelectCommand.Connection = SqlCon;
Da.SelectCommand.CommandType = CommandType.StoredProcedure;
Da.SelectCommand.CommandText = "YOUSPNAME";
Da.SelectCommand.Parameters.AddWithValue("@UserName", UserName);
Da.SelectCommand.Parameters.AddWithValue("@PASSWORD",PASSWORD);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900