TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
umair mohsin
1.4k
387
65.9k
Resume Page question
May 5 2017 1:38 PM
I wonna make a resume application in which only registered users are allowed to make resumes,
And some of the fields should filled by using their sign up details and others will fill by the user at runtime
I wonna do this thing using stored procedures i am trying this code on stored procedure
USE [APJobPortalDB]
CREAT PROCEDURE [dbo].[SelectUserDetailsForResume]
@UserId varchar(50)
AS
BEGIN
SET NOCOUNT ON;
-- Insert statements for procedure here;
SELECT * from Sign_Up where UserId=@UserId;
END
And in code behind i use this code
if (Page.Session["user"]!=null)
{
string constr = ConfigurationManager.ConnectionStrings["JPConstr"].ConnectionString.ToString();
SqlCommand cmd = new SqlCommand();
using (SqlConnection conn = new SqlConnection(constr))
{
conn.Open();
cmd.Connection = conn;
cmd = new SqlCommand("SelectUserDetailsForResume”, conn); //
cmd.Paramters.AddWithValue(“@UserId”,Page.Session[“user”]);
SqlDataReader sdr = cmd.ExecuteReader();
cmd.CommandType = CommandType.StoredProcedure;
while (sdr.Read())
{
txtname.Text = sdr["FullName"].ToString();
txtid.Text = sdr["UserId"].ToString();
ddlgender.SelectedValue = sdr["Gender"].ToString();
txtcity.Text = sdr["City"].ToString();
txtemail.Text = sdr["Email"].ToString();
txtcontact.Text = sdr["Contact"].ToString();
}
conn.Close();
}
I am sure the code is quite clear i may not need to simplify this.
By using this code textboxes are still empty which should be filled with appropriate user details.user id is supplied when user is logged in.on the contrary if i am using a single line query the issue is resolved that query is:
"select * from Sign_Up where UserId='" + Page.Session["user"].ToString() + "'"
The textboxes on the resume are now fillled with user details. I don’t know what is wrong as i am passing User id from session in my stored procedure but still not happening.can anyone help me to resolve this issue.i wonna make use of my stored procedure not this single line query.
an explanation would be helpful and appriciable.thanks
Reply
Answers (
1
)
Can someone explain me the code to delete data and updates
bind data on datagridview from sql db using ado.net objects