Click here to Skip to main content
   

ASP.NET

 
GeneralRe: Resource files show empty content PinmemberAli Al Omairi(Abu AlHassan)20-Jan-13 2:51 
GeneralRe: Resource files show empty content PinmvpSandeep Mewara20-Jan-13 4:01 
QuestionViewState not working in UserControl PinmemberJassim Rahma19-Jan-13 6:29 
AnswerRe: ViewState not working in UserControl [modified] Pinmemberjkirkerx19-Jan-13 19:35 
AnswerRe: ViewState not working in UserControl PinmemberRichard Deeming21-Jan-13 3:07 
QuestionHow can we export data into csv format in c#.net PinmemberEr Atul Sharma19-Jan-13 0:31 
AnswerRe: How can we export data into csv format in c#.net PinmvpSandeep Mewara19-Jan-13 6:54 
QuestionSQL Server error PinmemberPritam Sankar Roy18-Jan-13 19:31 
Hi, I am trying to insert some date to my SQL-Server using ASP.Net. But I am getting the error message like, " ExecuteNonQuery: Connection property has not been initialized." I am using store procedure to store the date. My code is
 
try
{
   SqlCommand cmd = new SqlCommand();
   cmd.Parameters.Clear();
   cmd.CommandType = CommandType.StoredProcedure;
   cmd.CommandText = "insertdata";
   if (rbt_Male.Checked)
   {
       cmd.Parameters.AddWithValue("@Name", txtbx_Name.Text);
       cmd.Parameters.AddWithValue("@Gender_Male", rbt_Male.Text);
       cmd.Parameters.AddWithValue("@Email", txtbx_Email.Text);
       cmd.Parameters.AddWithValue("@Dob", Convert.ToDateTime(txt_Dob.Text));
   }
   else if (rbt_Female.Checked)
   {
       cmd.Parameters.AddWithValue("@Name", txtbx_Name.Text);
       cmd.Parameters.AddWithValue("@Gender_Female", rbt_Male.Text);
       cmd.Parameters.AddWithValue("@Email", txtbx_Email.Text);
       cmd.Parameters.AddWithValue("@Dob", Convert.ToDateTime(txt_Dob.Text));
   }
   if (con.State == ConnectionState.Closed)
       con.Open();
   SqlCommand dataCommand = new SqlCommand(sql, dataConnection);
   cmd.ExecuteNonQuery();
   lbl_Errormsg.Visible = true;
   lbl_Errormsg.Text = "Record Inserted Successfully";
   con.Close();
}
catch (Exception ex)
{
   lbl_Errormsg.Visible = true;
   lbl_Errormsg.Text = ex.Message;
}

AnswerRe: SQL Server error PinmemberNandakishorerao18-Jan-13 22:39 
AnswerRe: SQL Server error PinmemberShameel23-Jan-13 5:51 
QuestionHow to asp:Literal with more..? PinmemberJassim Rahma18-Jan-13 4:19 
AnswerRe: How to asp:Literal with more..? PinmemberParwej Ahamad18-Jan-13 8:13 
AnswerRe: How to asp:Literal with more..? PinmemberNandakishorerao18-Jan-13 22:46 
QuestionFindControl not working in Gridview ItemTemplate of Button PinmemberMember 974870717-Jan-13 20:42 
AnswerRe: FindControl not working in Gridview ItemTemplate of Button Pingroupchester_it2118-Jan-13 7:16 
QuestionRe: FindControl not working in Gridview ItemTemplate of Button PinmemberNandakishorerao18-Jan-13 22:48 
AnswerRe: FindControl not working in Gridview ItemTemplate of Button PinmemberKanwal Daud Gill21-Jan-13 21:23 
GeneralRe: FindControl not working in Gridview ItemTemplate of Button PinmemberNandakishorerao21-Jan-13 21:49 
QuestionTracking Emails PinmemberJaison Joe17-Jan-13 18:49 
Questionhow to redirect in a url? PinmemberJassim Rahma17-Jan-13 10:42 
AnswerRe: how to redirect in a url? PinmemberParwej Ahamad18-Jan-13 8:17 
GeneralRe: how to redirect in a url? PinmemberJassim Rahma18-Jan-13 8:36 
GeneralRe: how to redirect in a url? PinmemberParwej Ahamad18-Jan-13 18:23 
AnswerRe: how to redirect in a url? PinmemberRekhash19-Jan-13 0:01 
QuestionHow to add KML file to google Map using javascript in asp.net PinmemberTrivikramarao Vurubandi17-Jan-13 1:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.150224.1 | Last Updated 27 Feb 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid