Link to home
Create AccountLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

Input string was not in a correct format

Hi,
When running the below codes,
                try
                {
                    cmd = new SqlCommand("insert into dbo.tab3 (user_id,rec_id,rec_desc,change_date) values (@par_id2,11,' ',getdate())", conn);

                    cmd.Parameters.Add("@par_id2", SqlDbType.Int).Value = Convert.ToInt32(lb_userid.Text);
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    lb_msg.Text = ex.Message + ex.Source;
                    return;
                }
                ...

I don't know why I've got this error.

Input string was not in a correct format.mscorlib
ASKER CERTIFIED SOLUTION
Avatar of Vel Eous
Vel Eous

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account