+ Post New Thread
Results 1 to 4 of 4
Coding Thread, VB.NET SQL Error in Coding and Web Development; I have an application which uses a SQL connection and brings data into a datagridview. The app allows the user ...
  1. #1
    Shrimpersfan's Avatar
    Join Date
    Feb 2008
    Location
    Peterborough
    Posts
    52
    Thank Post
    9
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    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.

  2. #2

    Join Date
    Jul 2009
    Location
    Burbank
    Posts
    2
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    I'm not familiar enough with VB.Net to know for sure ... but I do have some programming sense that may help ...
    [*]is the unsave record the first or last or somewhere in the middle?[*]are you sure that the problem is related to record count? (perhaps there is a bad record that gets included frequently based on selection criteria)[*]have you been able to identify & analyze the problematic record?[*]is there invalid data in the field?[*]does the database not allow null values in the field?[*]do you have some sort of character that is fooling the program? (line feed, paragraph mark, unmatched quote)

    I hope these thoughts have been useful in assisting you to find your problem.
    Celeste

  3. #3

    Join Date
    May 2009
    Location
    Towyn
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    If you are making changes then you should not be INSERTing but UPDATEing the records, there are fairly basic ways to iterate through your recordset finding just the records that have changed and then you can manually update the relevant entries. During this process you can also find new records and write them to the database via a slightly different method.

    If it help I'll be willing to have a look at the code for you.

  4. #4

    Join Date
    Feb 2009
    Posts
    45
    Thank Post
    1
    Thanked 5 Times in 5 Posts
    Rep Power
    12
    Quote Originally Posted by Shrimpersfan View Post
    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.

    Do you have another tool via which you can query the DB
    If so run a query something like
    Select * from <table> where QouteID is Null
    (you may need to vary the syntax of the above query to suit your DB)

    You should also try to get a defintion of the table containing the column QuoteID

    Your error condition suggests that the column QuoteID now has a Not-Null constraint applied to it & that in the past this may not havebeen true
    Now that you've trie to write a recotrd back to the DB - you are falling foul of this constraint

    If this turns out to be the correct analysis - then you should check any such rows
    Are they still valid - can you have rows where QuoteID is NULL

    If not then you can either delete the row (if the record & any associated data is invalid)
    Or you can try to specify a valid value for QuoteID - If you can determine such from other data



SHARE:
+ Post New Thread

Similar Threads

  1. ASP.net c# treeview from SQL
    By damienharrison in forum Web Development
    Replies: 5
    Last Post: 20th February 2012, 06:28 PM
  2. SQL server VVS Writer error message....
    By flashsnaps in forum Windows
    Replies: 1
    Last Post: 8th December 2008, 09:59 PM
  3. SQL error preventing nightly backups
    By WithoutMotive in forum MIS Systems
    Replies: 1
    Last Post: 28th August 2008, 10:53 AM
  4. sims.net sql server 2005
    By itgeek in forum MIS Systems
    Replies: 2
    Last Post: 14th March 2008, 07:02 PM
  5. Replies: 3
    Last Post: 7th July 2006, 03:21 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •