Retrieve Values from Db by passing parameter from previous Page - ASP.NET C# -
i new asp.net,
i having issue retrieving employee information db when passing userid previous page. have managed pass userid when selected data grid in page 1 when loading page 2 gives me error: invalid column name 'value of string passed'
below code:
page 1:
protected void imgbtnview_click(object sender, imageclickeventargs e)
{ imagebutton imgbtn = (imagebutton)sender; string userid = imgbtn.commandargument; response.redirect("employee.aspx?userid=" + userid); }
page 2 :
page load
protected void page_load(object sender, eventargs e) { txtemployeeno.text = request.querystring["userid"]; fillfields(txtemployeeno.text); }
method fillfields
private void fillfields(string user_id) { string commandstring = @"select * [dbo].[tbl_employee] [userid] = "+ user_id; datarow dr = global.startquery(commandstring).rows[0]; -- > global class txtemployeeno.text = user_id; txtfirstname.text = dr["firstname"].tostring(); txtlastname.text = dr["lastname"].tostring(); }
please tell me what's wrong in code.
thank in advance
user following line of code.
string commandstring = @"select * [dbo].[tbl_employee] [userid] = '"+user_id+"'";
Comments
Post a Comment