VB.NET SQL Error
-
I have an application which uses a SQL connection and brings data into a datagridview. The app allows the user to take this data, make changes on it and then save these changes. This is fine when the user only brings back and manipulates around 100 - 1000 records, when the recordset is higher than this, all records that have been manipulated get inserted into the database apart from 1 record. The error message within the application says 'Cannot insert NULL value into column 'QuoteID', column does not insert NULL's. Insert failed. The app always brings back this error when using a large recordset, when i look in the db to see how many had been imported, every record is saved except one. Just wondering if anyone had come across something like this before.
-
I have an application which uses a SQL connection and brings data into a datagridview. The app allows the user to take this data, make changes on it and then save these changes. This is fine when the user only brings back and manipulates around 100 - 1000 records, when the recordset is higher than this, all records that have been manipulated get inserted into the database apart from 1 record. The error message within the application says 'Cannot insert NULL value into column 'QuoteID', column does not insert NULL's. Insert failed. The app always brings back this error when using a large recordset, when i look in the db to see how many had been imported, every record is saved except one. Just wondering if anyone had come across something like this before.
Shrimpersfan wrote:
The error message within the application says 'Cannot insert NULL value into column 'QuoteID', column does not insert NULL's. Insert failed.
from above message, it is clear that column 'QuoteID' does not allow null value. whether you debug your code for record which have null value for column 'QuoteID'. Check for the last row of datagridview which may be contain null value for column 'QuoteID' (or for all fields)
Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11
-
Shrimpersfan wrote:
The error message within the application says 'Cannot insert NULL value into column 'QuoteID', column does not insert NULL's. Insert failed.
from above message, it is clear that column 'QuoteID' does not allow null value. whether you debug your code for record which have null value for column 'QuoteID'. Check for the last row of datagridview which may be contain null value for column 'QuoteID' (or for all fields)
Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11
Hi Rupesh. I have looked at the databases and looked for any NULL's in QuoteID but none appear. In my datagrid view, there is a white space below the last field (space to enter another record) but i shouldn't think the app will be trying to import a record from this. It's also strange how the import works with a smaller dataset but not with a large one. I have commandtimeout's in my code too. David
-
Hi Rupesh. I have looked at the databases and looked for any NULL's in QuoteID but none appear. In my datagrid view, there is a white space below the last field (space to enter another record) but i shouldn't think the app will be trying to import a record from this. It's also strange how the import works with a smaller dataset but not with a large one. I have commandtimeout's in my code too. David
Shrimpersfan wrote:
I have commandtimeout's in my code too.
whether you try to increase CommandTimeOut?
Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11
-
Shrimpersfan wrote:
I have commandtimeout's in my code too.
whether you try to increase CommandTimeOut?
Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11
Yes i tried different intervals, in the end i used 0 so the app should never time out. David
-
Yes i tried different intervals, in the end i used 0 so the app should never time out. David
can you post the code snippet so i review it for some clue?
Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11
-
can you post the code snippet so i review it for some clue?
Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11
Well my app uses stored procedures to call up data, will be a lot of code
-
Well my app uses stored procedures to call up data, will be a lot of code
Hmmm. i want to show only the code that how can you update the data from datagridview to database.Most probability is that you can not supply value of column 'QuoteId'( or all field for last record)
Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11
-
Hmmm. i want to show only the code that how can you update the data from datagridview to database.Most probability is that you can not supply value of column 'QuoteId'( or all field for last record)
Rupesh Kumar Swami Software Developer, Integrated Solution, Bikaner (India) My Company Award: Best VB.NET article of June 2008: Create Column Charts Using OWC11
Hi Rupesh. I seem to have sorted the problem. It seems as though a client had info missing in a completely seperate table. Thanks again. David