i tried your example on my storedprocedure login to fetch the account from user table and fetch the ad name from company account
ALTER PROCEDURE [dbo].[Validate_User5]
@UserName NVARCHAR(200),
@Password NVARCHAR(200)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @UserId INT, @LastLoginDate DATETIME
DECLARE @User3 AS TABLE(Id INT,UserName VARCHAR(20),LastLogin DATETIME,Password VARCHAR(20))
DECLARE @CompanyInfo AS TABLE(Id INT,UserName VARCHAR(20),Name VARCHAR(20))
SELECT a.Id,a.UserName,a.Password,a.LastLogin,d.Name
FROM @User3 a
JOIN @CompanyInfo d ON d.UserName = a.UserName
WHERE a.UserName = @UserName
IF @UserId IS NOT NULL
BEGIN
SELECT 1 -- User available.
END
ELSE
BEGIN
SELECT -1 -- User not available.
END
END
Now i have the login code which uses session
int UserID;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("Validate_User5"))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.CommandType = CommandType.StoredProcedure;
Session["UserName"] = ctlLogin.UserName;
Session["Name"] = ctlLogin.UserName;
// cmd.Parameters.AddWithValue("@Email", ctlLogin.UserName);
cmd.Parameters.AddWithValue("@UserName", ctlLogin.UserName);
cmd.Parameters.AddWithValue("@Password", (ctlLogin.Password));
now on page i have the code that help me to navigae to the very ad page of the user by clicking the company name and its not working only username is working
public string getUserHREF(object sURL)
{
DataRowView dRView = (DataRowView)sURL;
string username = dRView["Name"].ToString();
return ResolveUrl("~/ADPage.aspx?Id=" + username);
}