Quantcast
Viewing all articles
Browse latest Browse all 12583

The label 'Count' has already been declared. Label names must be unique within a query batch or stored procedure.

Dear Friends,

Im inserting multiple values from a screen on button click event, but im getting below error multiple times.. 

The label 'Count' has already been declared. Label names must be unique within a query batch or stored procedure.

The label 'Text' has already been declared. Label names must be unique within a query batch or stored procedure.

Can anyone explain me the reason behind this error? My code is right below. Thank You in advance

I regret if im not clear.

SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=SAHS;Integrated Security=True;MultipleActiveResultSets=true");
                    SqlCommand cmd = new SqlCommand("insert into StudentMaster(pk_id,GrNo,Name,DOB,Std,Div,RollNo,MobileNo,Address,TelNo,FathersName,FathersProfession,MothersName,MothersProfession,Age,Year,status,DOE,BookNo,FeesStatus,FthrsQlfction,FthrsOfcAdd,FthrsPhone,MthrsPhone,MthrsOfcAdd,MthrsQlfction,Bloodgrp,caste,Nationality,MotherTongue,PreviousSchool,Religion,height,weight,StdtImage,sex,SCode)values ("+ txt_Grno.Text + "," + txt_name + "," + dateTimePicker2.Value + "," + cb_class + "," + cb_div + "," + txt_roll + "," + txt_mobile + "," + Rtxt_ResiAdd + "," + txt_Phone + "," + txt_fname + "," + txt_fOccu + "," + txt_mName + "," + txt_mOccu + "," + txt_Age + ",getDate()," + cb_status + "," + dateTimePicker1.Value + "," + txt_bookno + "," + cb_feestat + "," + txt_fQualificatn + "," + Rtxt_fOfcAdd + "," + txt_fPhone + "," + txt_mPhone + "," + Rtxt_mOfcAdd + "," + txt_mQualificatn + "," + cb_BldGrp + "," + txt_caste + "," + txt_Nationality + "," + txt_MthrTng + "," + txt_PrevSchool + "," + txt_Relgn + "," + txt_hgt + "," + txt_weight + ","+pictureBox1.Image+"," + cb_Gender + ",studentcode", con);

                    /*//SAve image from Picturebox into memory stream object
                    MemoryStream ms = new MemoryStream();
                    pictureBox1.Image.Save(ms, ImageFormat.Jpeg);

                    //Read from Memory Stream object into ByteArray
                    Byte[] bytPicdata = new Byte[ms.Length];
                    ms.Position = 0;
                    ms.Read(bytPicdata, 0, Convert.ToInt32(ms.Length));

                    //Create parameter for the insert statement that contains image
                    SqlParameter prm = new SqlParameter("@Picdata", SqlDbType.VarBinary, bytPicdata.Length, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, bytPicdata);
                    cmd.Parameters.Add(prm);*/
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                    MessageBox.Show("inserted successfully");
                }



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>