Please solve this problem i am new to asp.net programming
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class NewUser : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TextBox4_TextChanged(object sender, EventArgs e)
{
}
protected void NewUser_submit_btn_Click(object sender, EventArgs e)
{
//try
//{
SqlConnection con = new SqlConnection("data source=user\\sqlexpress;" +
"Initial Catalog=TestDB;" +
"Integrated Security=SSPI");
string sql = "INSERT INTO employee VALUES(@empid,@name,@desig,@skill,@teamid,@mgrid,'"+TextBox5.Text+"','"+TextBox6.Text+"','" +TextBox7.Text+ "','"+TextBox8.Text+"',"+TextBox9.Text+","+TextBox10.Text+",'"+TextBox11.Text+"','"+TextBox12.Text+"','"+TextBox13.Text+"')";
using (SqlCommand com = new SqlCommand(sql, con))
{
com.Parameters.AddWithValue("@empid", TextBox1.Text);//Employee ID
com.Parameters.AddWithValue("@name", TextBox2.Text);
com.Parameters.AddWithValue("@desig", TextBox3.Text);
com.Parameters.AddWithValue("@skill", TextBox4.Text);
com.Parameters.AddWithValue("@teamid", DropDownList1.SelectedValue);
com.Parameters.AddWithValue("@mgrid", ""); //when I entring values in employee id textbox that value should be added there in dropdownlist2 and it should be displayed at every time
}
}
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
}
shyleshs 0 Newbie Poster
hericles 289 Master Poster Featured Poster
shyleshs 0 Newbie Poster
shyleshs 0 Newbie Poster
hericles 289 Master Poster Featured Poster
shyleshs 0 Newbie Poster
hericles 289 Master Poster Featured Poster
shyleshs 0 Newbie Poster
HunainHafeez 9 Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.