//in aspx page
OpenConnection();
SqlCommand cmd = new SqlCommand("test", connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserName", UserName);
cmd.Parameters.AddWithValue("@Password", Password);
cmd.Parameters.AddWithValue("@mode", "signinlogin");
SqlParameter p = new SqlParameter("@uname", SqlDbType.NVarChar, 1000);
SqlParameter p1 = new SqlParameter("@name", SqlDbType.NVarChar, 1000);
p.Direction = ParameterDirection.Output;
p1.Direction = ParameterDirection.Output;
cmd.Parameters.Add(p);
cmd.Parameters.Add(p1);
int INSID = cmd.ExecuteNonQuery();
string Output = cmd.Parameters["@uname"].Value.ToString();
string Output1 = cmd.Parameters["@name"].Value.ToString();
UserDetails sbintValue = new UserDetails();
CloseConnection();
//in sql
create procedure test
@mode varchar(20),
@username nvarchar(1000)=null,
@password varchar(max)=null,
@name nvarchar(1000) =null output,
@uname varchar(max) =null output
as
begin
if(@mode='signinlogin')
begin
select @name=Firstname,@uname=email from tablename where password =@password and username=@username
end
end