Import CSV to sql server table using the following code
SqlCommand nonqueryCommand = myConnection.CreateCommand(); nonqueryCommand.CommandText = "INSERT INTO MYTABLE VALUES(@num1, @num2,@num3,@num4)"; nonqueryCommand.Parameters.Add("@num1",SqlDbType.Decimal); nonqueryCommand.Parameters.Add("@num2", SqlDbType.Decimal); nonqueryCommand.Parameters.Add("@num3", SqlDbType.Decimal); nonqueryCommand.Parameters.Add("@num4", SqlDbType.Decimal); nonqueryCommand.Parameters["@num1"].Value = crntRecord[0]; nonqueryCommand.Parameters["@num2"].Value = crntRecord[1]; nonqueryCommand.Parameters["@num3"].Value =crntRecord[3]; nonqueryCommand.Parameters["@num4"].Value = crntRecord[4]; nonqueryCommand.ExecuteNonQuery();
where parameters 3 and 4 are of type decimal (9.6) in DDL, when I execute the code in ExecuteNonQuery , I get the following exception
Failed to convert parameter value from string to decimal.
please help me find out tnx problem.
EDIT
the value in crntRecord [3] looks like

source share