datagridview automatically converting string to double

ravi kumar 331 Reputation points
2022-05-05T10:03:58.663+00:00

I am trying to insert data from my datagridview to sql server but while saving the datatype of "material" is changing to double column

  1. I have double checked the datatype at my sql server 199221-image.png
  2. I have double checked the datatype at dataset designer also 199215-image.png

still while saving this is the end result

199147-image.png

Please guide how to solve this .

Datagrid column property:
199140-image.png
i am using "ADGV" nugget for datagridview
199203-image.png

code for saving the data:

 private void tool_ManagementBindingNavigatorSaveItem_Click(object sender, EventArgs e)  
        {  
            try  
            {  
                String msg = "Confirm Save?";  
                String caption = "Save Record";  
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;  
                MessageBoxIcon ico = MessageBoxIcon.Question;  
                DialogResult result;  
                result = MessageBox.Show(this, msg, caption, buttons, ico);  
                if (result == DialogResult.Yes)  
                {  
                    this.Validate();  
                    this.tool_ManagementBindingSource.EndEdit();  
                    this.tableAdapterManager.UpdateAll(this.pINQCDataSet);  
                    MessageBox.Show("The Record saved Successfully", "Save_Update",  
                        MessageBoxButtons.OK, MessageBoxIcon.Information);  
                    //this.Close();  
                }  
                else  
                {  
                    return;  
                }  
            }  
            catch (Exception ex)  
            {  
                MessageBox.Show("Saving Failed:" + ex.Message.ToString(), "Save",  
                    MessageBoxButtons.OK, MessageBoxIcon.Error);  
            }  
        }  
Developer technologies Windows Forms
SQL Server Other
Developer technologies C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.