Hello Sir,
I have made a registration form and i have connected it to the database as follows:-
protected void Button9_Click(object sender, EventArgs e)
{
String facilities="";
String recuritementof="";
String intrvwmode1="",intrvwmode2="",intrvwmode3="",intrvwmode4="";
String cintletter="";
String pneeded="";
SqlConnection conn = new SqlConnection();
SqlCommand comm = new SqlCommand();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["abc"].ToString();
comm.Connection = conn;
comm.CommandType = CommandType.Text;
comm.Parameters.Add(new SqlParameter("@rname",TextBox8.Text));
comm.Parameters.Add(new SqlParameter("@cname",TextBox9.Text));
comm.Parameters.Add(new SqlParameter("@country", TextBox10.Text));
comm.Parameters.Add(new SqlParameter("@state", TextBox11.Text));
comm.Parameters.Add(new SqlParameter("@city", TextBox12.Text));
comm.Parameters.Add(new SqlParameter("@craddress", TextBox13.Text));
comm.Parameters.Add(new SqlParameter("@paddress", TextBox14.Text));
comm.Parameters.Add(new SqlParameter("@hremail", TextBox15.Text));
comm.Parameters.Add(new SqlParameter("@cphone", TextBox16.Text));
comm.Parameters.Add(new SqlParameter("@hrphone", TextBox17.Text));
comm.Parameters.Add(new SqlParameter("@faxnum", TextBox18.Text));
comm.Parameters.Add(new SqlParameter("@pincode", TextBox19.Text));
comm.Parameters.Add(new SqlParameter("@caddress", TextBox20.Text));
comm.Parameters.Add(new SqlParameter("@cstartingdate", TextBox21.Text));
comm.Parameters.Add(new SqlParameter("@dealsin", TextBox22.Text));
comm.Parameters.Add(new SqlParameter("@recuritementfor", DropDownList5.SelectedItem.ToString()));
if(RadioButton6.Checked)
{
recuritementof="Male";
}
else
{
recuritementof="Female";
}
comm.Parameters.Add(new SqlParameter("@recuritementof",recuritementof));
comm.Parameters.Add(new SqlParameter("@numofcandidates", TextBox23.Text));
comm.Parameters.Add(new SqlParameter("@exprequired", DropDownList6.SelectedItem.ToString()));
comm.Parameters.Add(new SqlParameter("@qualification", DropDownList11.SelectedItem.ToString()));
comm.Parameters.Add(new SqlParameter("@reliability", TextBox25.Text));
comm.Parameters.Add(new SqlParameter("@ctc", TextBox26.Text));
if(RadioButton8.Checked)
{
facilities="TA";
}
else if(RadioButton9.Checked)
{
facilities="DA";
}
else if(RadioButton10.Checked)
{
facilities="HRA";
}
else
{
facilities="Medical Support";
}
comm.Parameters.Add(new SqlParameter("@facilities", facilities));
comm.Parameters.Add(new SqlParameter("@candidateemail", TextBox27.Text));
comm.Parameters.Add(new SqlParameter("@candidatephone", TextBox28.Text));
comm.Parameters.Add(new SqlParameter("@aboutcmpny", TextBox29.Text));
comm.Parameters.Add(new SqlParameter("@jobopeningdate", TextBox30.Text));
comm.Parameters.Add(new SqlParameter("@jobclosingdate", TextBox31.Text));
if (RadioButton12.Checked)
{
intrvwmode1 = "Telephonic";
}
else
{
intrvwmode1 = "Aptitude Test";
}
if (RadioButton14.Checked)
{
intrvwmode2 = "GD";
}
else
{
intrvwmode2 = "Technical Test";
}
if (RadioButton16.Checked)
{
intrvwmode3 = "Personal Interview";
}
else
{
intrvwmode3 = "Account Checking";
}
if (RadioButton18.Checked)
{
intrvwmode4 = "Giving Offer Letter";
}
comm.Parameters.Add(new SqlParameter("@interviewmode", intrvwmode1 + intrvwmode2 + intrvwmode3 + intrvwmode4));
comm.Parameters.Add(new SqlParameter("@venue", TextBox32.Text));
comm.Parameters.Add(new SqlParameter("@reachat",TextBox33.Text));
if(RadioButton19.Checked)
{
cintletter="Yes";
}
else
{
cintletter="No";
}
comm.Parameters.Add(new SqlParameter("@carryletter", cintletter));
comm.Parameters.Add(new SqlParameter("@industry", DropDownList7.SelectedItem.ToString()));
comm.Parameters.Add(new SqlParameter("@rolepost", DropDownList12.SelectedItem.ToString()));
comm.Parameters.Add(new SqlParameter("@howknow", DropDownList8.SelectedItem.ToString()));
if(RadioButton3.Checked)
{
pneeded="Platinum";
}
else if(RadioButton4.Checked)
{
pneeded="Gold";
}
else
{
pneeded="Silver";
}
comm.Parameters.Add(new SqlParameter("@planneed", pneeded));
comm.Parameters.Add(new SqlParameter("@charges", DropDownList9.SelectedItem.ToString()));
comm.Parameters.Add(new SqlParameter("@paymentmode",DropDownList10.SelectedItem.ToString()));
comm.CommandText = "insert into recuriter values(@rname,@cname,@country,@state,@city,@craddress,@paddress,@hremail,@cphone,@hrphone,@faxnum,@pincode,@caddress,@cstartingdate,@dealsin,@recuritementfor,@recuritementof,@numofcandidates,@candidatephone,@exprequired,@qualification,@ctc,@facilities,@candidateemail,@candidatephone,@aboutcmpny,@jobopeningdate,@jobclosingdate,@interviewmode,@venue,@reachat,@carryletter,@industry,@rolepost,@howknow,@planneed,@charges,@paymentmode)";
conn.Open();
comm.ExecuteNonQuery();
conn.Close();
comm.Parameters.Clear();
}
but when i click at the submit button than it does nothing an its running properly no error is giving. Now i am unable to understand that why the values are not going in to the database.
sir please give me any possible solution.
Thank You.