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);  
            }  
        }  
Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,870 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,325 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,629 questions
{count} votes