Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET4.0
I am new to .NET . I have created an table.Now i want to display the details of a table that i have inserted into it.Please provide a simple code so that i can easily under stand
Posted 19-Nov-12 2:16am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

//this is the stored procedure:
ALTER PROCEDURE [dbo].[LogInProcedure]
	@username nvarchar (50),
	@password nvarchar (50),
	@groupnum nvarchar (50)
AS
	SET NOCOUNT ON;
SELECT	* FROM users 
WHERE	user_username=@username AND user_password=@password
//this is the code for retrieving info from it:
public bool doLogIn(string username, string password)
        {
            con.Open();
 
            SqlCommand cmd = new SqlCommand("LogInProcedure", con);
            cmd.CommandType = CommandType.StoredProcedure;
 
            cmd.Parameters.AddWithValue("@username", username);
            cmd.Parameters.AddWithValue("@password", password);
 
            SqlDataReader read = cmd.ExecuteReader();
 
            if (read.HasRows)
                return true;
            else
                return false;
        }
  Permalink  
Comments
vinod.sambangi at 19-Nov-12 8:33am
   
I think you might have said by using layering concept.But i want to display the details while the page was loading itself.So please tell me what to write while the page was loading to display the table data in a asp.net page
Krunal R at 19-Nov-12 8:41am
   
Call this function on Page_Load event.
vinod.sambangi at 20-Nov-12 3:21am
   
Which function??i could call
Krunal R at 20-Nov-12 6:27am
   
public bool doLogIn(string username, string password)

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

  Print Answers RSS
0 OriginalGriff 205
1 Sergey Alexandrovich Kryukov 185
2 jlopez788 144
3 Rob Philpott 100
4 Prakriti Goyal 97
0 OriginalGriff 6,837
1 Sergey Alexandrovich Kryukov 5,559
2 Maciej Los 3,479
3 Peter Leow 3,323
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100