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
ashwin
NA
1
789
how to update values in a dropdown list from different table
Feb 23 2015 4:18 AM
on.Open();
string first_name = tb_first_name.Text;
string middle_name = tb_middle_name.Text;
string last_name = tb_last_name.Text;
string emp_group = ddl_emp_group_id.SelectedValue;
string emp_designation = ddl_emp_designation.SelectedValue;
int hrgroup_id = Convert.ToInt32(ddl_emp_group_id.SelectedValue);
int hrdesignation_id = Convert.ToInt32(ddl_emp_designation.SelectedValue);
string email_id = tb_email_id.Text;
string mobile_no = tb_mobile_no.Text;
string gender = rbl_gender.Text;
string login = tb_login.Text;
string synopsis = tb_synopsis.Text;
int hid = Convert.ToInt32(hidden_id.Value);
//String UpdateQuery = "Update hrEmpDetails set first_name=@first_name,middle_name=@middle_name,last_name=@last_name,email_id=@email_id,mobile_no=@mobile_no,gender=@gender,login=@login,synopsis=@synopsis where id =" + hid + ";";
String UpdateQuery = "Update hrEmpDetails set first_name='" + first_name + "', middle_name='" + middle_name + "',last_name='" + last_name + "',hrgroup_id=" + hrgroup_id + ",hrdesignation_id=" + hrdesignation_id + " ,email_id='" + email_id + "',mobile_no='" + mobile_no + "',gender='" + gender + "',login='" + login + "',synopsis='" + synopsis + "' where id =" + hid + ";";
SqlCommand cmd = new SqlCommand(UpdateQuery, con);
cmd.ExecuteNonQuery();
con.Close();
BindDataToGridView();
}
Here hrEmpDetails is the table name and i want to update the emp_group and emp_designation which is in the other table .
The hrgroup_id and hrdesignation_id provide id's for emp_group and emp_designation . hrgroup_id and hrdesignation_id is in table hrEmpDetails
Reply
Answers (
1
)
SAMPLE MIS
Code for send sms is not working