Input string was not in a correct format. getting an error

sql user , csharp Developmet problem , we development Kathmandu, Nepal
  • 11 years ago

    hi everyone i m getting this error"Input string was not in a correct format." when ever i delete the record and try to save for the update of the table. the erros show while calling the method private void DeleteAttachment(int i) { if (attachmentIdString[i] != "") { _conn.Open(); SqlCommand sqlCmd = new SqlCommand("DELETE FROM Attachment WHERE attachmentId=@id", _conn);

     **   sqlCmd.Parameters.Add("@id", SqlDbType.BigInt, 8).Value = Int64.Parse(attachmentIdString[i]);*****

    i think its problem while converting but not sure of that can anyone please suggest me something as i m a new user of c # .net

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila” - Mitch Ratcliffe