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

sql user , csharp Developmet problem , we development Kathmandu, Nepal
  • 8 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]);*****
                sqlCmd.ExecuteNonQuery();
                _conn.Close();
    
            }
            else
                _conn.Close();
        }
    

    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).

Contribute

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.

“The greatest performance improvement of all is when a system goes from not-working to working.” - John Ousterhout