DeveloperSection

Home / DeveloperSection / Forums / Showing Error- Except a parameter which is not supplied

Showing Error- Except a parameter which is not supplied

Anonymous User 2185 01-Dec-2014

I want to execute the query but on the datastore parameter it is showing an error excepts a parameter which is not supplied.Please help me out regarding this.

 

My code is-

 
                           SqlConnection conn = new SqlConnection(str);
                           conn.Open();
                           Console.WriteLine('TicketNo {0}', itm);
 
                           string SwimSR = '';
                           SwimSR += 'Insert into SwimSR1(Id,State,Title,Datastore,AreaId,AreaPath,PlannedStartDate,PlannedEndDate,RequestedEta,SeManTexEta,Owner,Reason,ChangedBy,ChangedDate,CreatedBy,CreatedDate,NodeName,Trio,Type,BusinessCategory,Description)';
                           SwimSR += 'Values(@Id,@State,@Title,@Datastore,@AreaId,@AreaPath,@PlannedStartDate,@PlannedEndDate,@RequestedEta,@SeManTexEta,@Owner,@Reason,@ChangedBy,@ChangedDate,@CreatedBy,@CreatedDate,@NodeName,@Trio,@Type,@BusinessCategory,@Description)';
                             SqlCommand cmd = new SqlCommand(SwimSR, conn);
 
                             cmd.Parameters.Add(new SqlParameter('@Id',swimTicket[itm].swimTicketData.Id));
 
                             cmd.Parameters.Add(new SqlParameter('@State',swimTicket[itm].swimTicketData.State));
                             cmd.Parameters.Add(new SqlParameter('@Title',swimTicket[itm].swimTicketData.Title));
                             cmd.Parameters.Add(new SqlParameter('@Datastore',swimTicket[itm].swimTicketData.Datastore));
                             cmd.Parameters.Add(new SqlParameter('@AreaId', swimTicket[itm].swimTicketData.AreaId));
                             cmd.Parameters.Add(new SqlParameter('@AreaPath', swimTicket[itm].swimTicketData.AreaPath));
                             cmd.Parameters.Add(new SqlParameter('@PlannedStartDate', swimTicket[itm].swimTicketData.PlannedStartDate));
                             cmd.Parameters.Add(new SqlParameter('@PlannedEnddate', swimTicket[itm].swimTicketData.PlannedEndDate));
                             cmd.Parameters.Add(new SqlParameter('@RequestedEta', swimTicket[itm].swimTicketData.RequestedEta));
                             cmd.Parameters.Add(new SqlParameter('@SemanTexEta', swimTicket[itm].swimTicketData.SeManTexEta));
                             cmd.Parameters.Add(new SqlParameter('@Owner', swimTicket[itm].swimTicketData.Owner));
                             cmd.Parameters.Add(new SqlParameter('@Reason', swimTicket[itm].swimTicketData.Reason));
                             cmd.Parameters.Add(new SqlParameter('@ChangedBy', swimTicket[itm].swimTicketData.ChangedBy));
                             cmd.Parameters.Add(new SqlParameter('@ChangedDate', swimTicket[itm].swimTicketData.ChangedDate));
                             cmd.Parameters.Add(new SqlParameter('@CreatedBy', swimTicket[itm].swimTicketData.CreatedBy));
                             cmd.Parameters.Add(new SqlParameter('@CreatedDate', swimTicket[itm].swimTicketData.CreatedDate));
                             cmd.Parameters.Add(new SqlParameter('@NodeName', swimTicket[itm].swimTicketData.NodeName));
                             cmd.Parameters.Add(new SqlParameter('@Trio', swimTicket[itm].swimTicketData.Trio));
                             cmd.Parameters.Add(new SqlParameter('@Type', swimTicket[itm].swimTicketData.Type));
                             cmd.Parameters.Add(new SqlParameter('@BusinessCategory', swimTicket[itm].swimTicketData.BusinessCategory));
                             cmd.Parameters.Add(new SqlParameter('@Description', swimTicket[itm].swimTicketData.Description));
 
 
                           cmd.ExecuteNonQuery();
                           Console.WriteLine('added');
                           conn.Close();


Updated on 02-Dec-2014
I am a content writter !

Leave Answer


Please enter your answer.


1 Answers

Liked By