help with Access violation error-VBForums
Results 1 to 9 of 9

Thread: help with Access violation error

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2011
    Posts
    32

    help with Access violation error

    I have an application that is access SQL database.

    I am getting an access violation error:
    The program '[10552] UR.vshost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.


    It always happens when I attempt to fill the dataset:
    Code:
    Me.URTableAdapter.Fill(Me.URDataSet.UR)
    I am not sure where to go to figure this out.

    I have been in the dataset designer and everything looks good there.

    Thank you,

    Steve Hathaway

  2. #2

    Thread Starter
    Member
    Join Date
    Dec 2011
    Posts
    32

    Re: help with Access violation error

    i am thinking that something is wrong with the database, because even when I load up older copies of the code, it fails at the same point, while trying to fill that table.

    Is there a way I can test the table? there is only one field that doesn't accept nulls and only one key.

    Here is some other text I see just above the access violation error message.

    Exception thrown: 'System.Data.ConstraintException' in System.Data.dll
    System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>UR.vshost.exe</AppDomain><Exception><ExceptionType>System.Data.ConstraintException, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.</Message><StackTrace> at System.Data.DataSet.EnableConstraints()
    at System.Data.DataSet.set_EnforceConstraints(Boolean value)
    at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
    at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
    at UR.URDataSetTableAdapters.URTableAdapter.Fill(URDataTable dataTable) in H:\Databases\UR\UREvolv\UR\URDataSet.Designer.vb:line 10313
    at UR.DataEntry.DataEntry_Load(Object sender, EventArgs e) in H:\Databases\UR\UREvolv\UR\DataEntry.vb:line 23
    at System.Windows.Forms.Form.OnLoad(EventArgs e)
    at System.Windows.Forms.Form.OnCreateControl()
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    at System.Windows.Forms.Control.CreateControl()
    at System.Windows.Forms.Control.WmShowWindow(Message&amp;amp; m)
    at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</StackTrace><ExceptionString>System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
    at System.Data.DataSet.EnableConstraints()
    at System.Data.DataSet.set_EnforceConstraints(Boolean value)
    at System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
    at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
    at UR.URDataSetTableAdapters.URTableAdapter.Fill(URDataTable dataTable) in H:\Databases\UR\UREvolv\UR\URDataSet.Designer.vb:line 10313
    at UR.DataEntry.DataEntry_Load(Object sender, EventArgs e) in H:\Databases\UR\UREvolv\UR\DataEntry.vb:line 23
    at System.Windows.Forms.Form.OnLoad(EventArgs e)
    at System.Windows.Forms.Form.OnCreateControl()
    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
    at System.Windows.Forms.Control.CreateControl()
    at System.Windows.Forms.Control.WmShowWindow(Message&amp;amp; m)
    at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)</ExceptionString></Exception></TraceRecord>

  3. #3
    Fanatic Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    603

    Re: help with Access violation error

    Without knowing the structure of the Dataset it is hard to pinpoint the issue here, however you are either loading a duplicate value into a column marked as unique or trying to load a null value into a column that won't accept nulls (could be something like an integer that is null in the database)

  4. #4

    Thread Starter
    Member
    Join Date
    Dec 2011
    Posts
    32

    Re: help with Access violation error

    I copied the sql design window here. Only field that is unique is the URID and its the only one that can't accept NULLs



    URID int Unchecked
    FileStatus int Checked
    URType int Checked
    LOC varchar(50) Checked
    ReviewID int Checked
    RevDate date Checked
    Rationale varchar(50) Checked
    BFCID varchar(50) Checked
    CLname varchar(50) Checked
    CFname varchar(50) Checked
    CMI varchar(50) Checked
    ActivityStartDate date Checked
    FundingSource varchar(50) Checked
    CWLastName varchar(50) Checked
    CWFirstName varchar(50) Checked
    SupervisorFirstName varchar(50) Checked
    SupervisorLastName varchar(50) Checked
    Region varchar(50) Checked
    ProgName varchar(100) Checked
    Status varchar(25) Checked
    OG1 smallint Checked
    OG1Com varchar(500) Checked
    OG1rf bit Checked
    OG2 smallint Checked
    OG2Com varchar(500) Checked
    OG2rf bit Checked
    OG3 smallint Checked
    OG3Com varchar(500) Checked
    OG3rf bit Checked
    OG4 smallint Checked
    OG4Com varchar(500) Checked
    OG4rf bit Checked
    OG5 smallint Checked
    OG5Com varchar(500) Checked
    OG5rf bit Checked
    OG6a smallint Checked
    OG6Com varchar(500) Checked
    OG6rf bit Checked
    OG6b smallint Checked
    OG6bCom varchar(500) Checked
    OG6brf bit Checked
    OG7a smallint Checked
    OG7aCom varchar(500) Checked
    OG7arf bit Checked
    OG7b smallint Checked
    OG7bCom varchar(500) Checked
    OG7brf bit Checked
    OG8a smallint Checked
    OG8aCom varchar(500) Checked
    OG8arf bit Checked
    OG8b smallint Checked
    OG8bCom varchar(500) Checked
    OG8brf bit Checked
    OG8c smallint Checked
    OG8cCom varchar(500) Checked
    OG8crf bit Checked
    OG8di smallint Checked
    OG8diCom varchar(500) Checked
    OG8dirf bit Checked
    OG8dii smallint Checked
    OG8diiCom varchar(500) Checked
    OG8diirf bit Checked
    OG9a smallint Checked
    OG9aCom varchar(500) Checked
    OG9arf bit Checked
    OG9b smallint Checked
    OG9bCom varchar(500) Checked
    OG9brf bit Checked
    OG10a smallint Checked
    OG10aCom varchar(500) Checked
    OG10arf bit Checked
    OG10b smallint Checked
    OG10bCom varchar(500) Checked
    OG10brf bit Checked
    OG10c smallint Checked
    OG10cCom varchar(500) Checked
    OG10crf bit Checked
    OG10d smallint Checked
    OG10dCom varchar(500) Checked
    OG10drf bit Checked
    OG11 smallint Checked
    OG11Com varchar(500) Checked
    OG11rf bit Checked
    OG12 smallint Checked
    OG12Com varchar(500) Checked
    OG12rf bit Checked
    OG13 smallint Checked
    OG13Com varchar(500) Checked
    OG13rf bit Checked
    OG14a smallint Checked
    OG14aCom varchar(500) Checked
    OG14arf bit Checked
    OG14b smallint Checked
    OG14bCom varchar(500) Checked
    OG14brf bit Checked
    OG15a smallint Checked
    OG15aCom varchar(500) Checked
    OG15arf bit Checked
    OG15b smallint Checked
    OG15bCom varchar(500) Checked
    OG15brf bit Checked
    OG16a smallint Checked
    OG16aCom varchar(500) Checked
    OG16arf bit Checked
    OG16b smallint Checked
    OG16bCom varchar(500) Checked
    OG16brf bit Checked
    OG17a smallint Checked
    OG17aCom varchar(500) Checked
    OG17arf bit Checked
    OG17b smallint Checked
    OG17bCom varchar(500) Checked
    OG17brf bit Checked
    OG17c smallint Checked
    OG17cCom varchar(500) Checked
    OG17crf bit Checked
    OG17d smallint Checked
    OG17dCom varchar(500) Checked
    OG17drf bit Checked
    OG17e smallint Checked
    OG17eCom varchar(500) Checked
    OG17erf bit Checked
    OG17f smallint Checked
    OG17fCom varchar(500) Checked
    OG17frf bit Checked
    OG17g smallint Checked
    OG17gCom varchar(500) Checked
    OG17grf bit Checked
    OG17h smallint Checked
    OG17hCom varchar(500) Checked
    OG17hrf bit Checked
    OG17i smallint Checked
    OG17iCom varchar(500) Checked
    OG17irf bit Checked
    OG17j smallint Checked
    OG17jCom varchar(500) Checked
    OG17jrf bit Checked
    OG17k smallint Checked
    OG17kCom varchar(500) Checked
    OG17krf bit Checked
    OG17l smallint Checked
    OG17lCom varchar(500) Checked
    OG17lrf bit Checked
    OG17m smallint Checked
    OG17mCom varchar(500) Checked
    OG17mrf bit Checked
    OG17n smallint Checked
    OG17nCom varchar(500) Checked
    OG17nrf bit Checked
    OG17o smallint Checked
    OG17oCom varchar(500) Checked
    OG17orf bit Checked
    OG17p smallint Checked
    OG17pCom varchar(500) Checked
    OG17prf bit Checked
    OG17q smallint Checked
    OG17qCom varchar(500) Checked
    OG17qrf bit Checked
    OG17r smallint Checked
    OG17rCom varchar(500) Checked
    OG17rrf bit Checked
    OG17s smallint Checked
    OG17sCom varchar(500) Checked
    OG17srf bit Checked
    OG17t smallint Checked
    OG17tCom varchar(500) Checked
    OG17trf bit Checked
    OG17u smallint Checked
    OG17uCom varchar(500) Checked
    OG17urf bit Checked
    Qi1a smallint Checked
    Qi1aCom varchar(500) Checked
    Qi1arf bit Checked
    Qi1b smallint Checked
    Qi1bCom varchar(500) Checked
    Qi1brf bit Checked
    Qi1c smallint Checked
    Qi1cCom varchar(500) Checked
    Qi1crf bit Checked
    Qi1d smallint Checked
    Qi1dCom varchar(500) Checked
    Qi1drf bit Checked
    Qi2 smallint Checked
    Qi2Com varchar(500) Checked
    Qi2rf bit Checked
    Qi3a smallint Checked
    Qi3aCom varchar(500) Checked
    Qi3arf bit Checked
    Qi3b smallint Checked
    Qi3bCom varchar(500) Checked
    Qi3brf bit Checked
    Qi3c smallint Checked
    Qi3cCom varchar(500) Checked
    Qi3crf bit Checked
    Qi4a smallint Checked
    Qi4aCom varchar(500) Checked
    Qi4arf bit Checked
    Qi4b smallint Checked
    Qi4bCom varchar(500) Checked
    Qi4brf bit Checked
    Qi4c smallint Checked
    Qi4cCom varchar(500) Checked
    Qi4crf bit Checked
    Qi4d smallint Checked
    Qi4dCom varchar(500) Checked
    Qi4drf bit Checked
    Qi4e smallint Checked
    Qi4eCom varchar(500) Checked
    Qi4erf bit Checked
    EnteredBy varchar(100) Checked
    EnteredDate datetime Checked
    ModifiedBy varchar(100) Checked
    ModifiedDate datetime Checked
    DeletedBy varchar(100) Checked
    DeletedDate datetime Checked
    FlagDeleted bit Checked
    Feedback varchar(MAX) Checked
    Unchecked

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2011
    Posts
    32

    Re: help with Access violation error

    I just restored the DB to a different folder and called it UR2. I restored my code from a backup, changed the connection string from UR to UR2.

    I am still getting the same errors.

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,256

    Re: help with Access violation error

    It's not your datatabase... it's your datatable. It sounds like you have a typed dataset that is out of sync with the database. In other words, the database maybe allowing nulls, but your dataset/datatable isn't. You need to refresh it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    Member
    Join Date
    Dec 2011
    Posts
    32

    Re: help with Access violation error

    Quote Originally Posted by techgnome View Post
    It's not your datatabase... it's your datatable. It sounds like you have a typed dataset that is out of sync with the database. In other words, the database maybe allowing nulls, but your dataset/datatable isn't. You need to refresh it.

    -tg
    I tried it the way I found, going into the designer, right click on the tableadapter, click configure, goto into advanced options and make sure refresh table is checked, then go through next, next and finish.

    This didn't do anything for my situation.

    If there is a different way to refresh the dataset/datatable, please let me know.

    Thank you,

    STeve

  8. #8

    Thread Starter
    Member
    Join Date
    Dec 2011
    Posts
    32

    Re: help with Access violation error

    Also, the .exe was working Friday afternoon, Then used again this morning. Nothing had changed or been modified.

  9. #9
    Fanatic Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    603

    Re: help with Access violation error

    If the application worked last week and nothing has changed with the application itself (same .exe, no recompiles, redeploys etc.) then the cause is probably in the database. Do any of the numeric columns in the database table have a null anywhere? If so there is a good chance that is causing the crash, try looking at recently added data and see if there are nulls present.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.