Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB.Net code wont ework propertly under certain account conditions

VB.Net code wont ework propertly under certain account conditions

Scheduled Pinned Locked Moved Visual Basic
databasecsharpcsssysadmin
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Martin Stevens
    wrote on last edited by
    #1

    Hi I’m having some problems with a small vb.net application I wrote that inserts data into an Access database. When I run the application as my self it works comepletely fine on the Windows 2003 server or my desktop XP box. But when I run it under a local admin account on the Win 2003 server box it does not work and spits our the following error for each insert. “The field is too small to accept the amount of data you attempted to add.” The bit I’m having a difficult time understand is why it works under my logon and not a local server logon. There are no domain policies or restrictions in place over the server or local account function on the server. It seems to have something to do with jet/eledb. It is not possibly for the data to be to large because; 1). I’ve got a string limit function which chops of anything larger that what the field should be and this is far less than the Access DB memo field that most columns are set at. 2). I’ve done a thorough analysis of the data and none if it exceeds the maximum column size. My vb.net code it fairly typical…… Try Dim ConnectString, SelectStatement As String Dim Connect As OleDb.OleDbConnection = New OleDb.OleDbConnection ConnectString = (My.Settings("Access_db_tests")) SelectStatement = "INSERT INTO test_information (pk_test_information, department_name)" Connect = New OleDb.OleDbConnection(ConnectString) Dim Cmd As New OleDb.OleDbCommand(SelectStatement, Connect) With Cmd.Parameters .Add(New OleDb.OleDbParameter("@parameter_pk_test_information", pk_test_information)) .Add(New OleDb.OleDbParameter("@parameter_department_name", department_name)) End With Connect.Open() Cmd.ExecuteNonQuery() Connect.Close() Connect.Dispose() Catch Ex As Exception Dim details As String = "pk_test_information = " & pk_test_information & _ " insert_row_to_Access_database - error message >> " & Ex.Message log_exception(details) End Try Does anyone have any ideas? Any feedback would be much appreciated. M:)

    L D 2 Replies Last reply
    0
    • M Martin Stevens

      Hi I’m having some problems with a small vb.net application I wrote that inserts data into an Access database. When I run the application as my self it works comepletely fine on the Windows 2003 server or my desktop XP box. But when I run it under a local admin account on the Win 2003 server box it does not work and spits our the following error for each insert. “The field is too small to accept the amount of data you attempted to add.” The bit I’m having a difficult time understand is why it works under my logon and not a local server logon. There are no domain policies or restrictions in place over the server or local account function on the server. It seems to have something to do with jet/eledb. It is not possibly for the data to be to large because; 1). I’ve got a string limit function which chops of anything larger that what the field should be and this is far less than the Access DB memo field that most columns are set at. 2). I’ve done a thorough analysis of the data and none if it exceeds the maximum column size. My vb.net code it fairly typical…… Try Dim ConnectString, SelectStatement As String Dim Connect As OleDb.OleDbConnection = New OleDb.OleDbConnection ConnectString = (My.Settings("Access_db_tests")) SelectStatement = "INSERT INTO test_information (pk_test_information, department_name)" Connect = New OleDb.OleDbConnection(ConnectString) Dim Cmd As New OleDb.OleDbCommand(SelectStatement, Connect) With Cmd.Parameters .Add(New OleDb.OleDbParameter("@parameter_pk_test_information", pk_test_information)) .Add(New OleDb.OleDbParameter("@parameter_department_name", department_name)) End With Connect.Open() Cmd.ExecuteNonQuery() Connect.Close() Connect.Dispose() Catch Ex As Exception Dim details As String = "pk_test_information = " & pk_test_information & _ " insert_row_to_Access_database - error message >> " & Ex.Message log_exception(details) End Try Does anyone have any ideas? Any feedback would be much appreciated. M:)

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Martijn Groen wrote:

      Does anyone have any ideas?

      This guy[^] knows almost everything; the first hit is it. :)

      Luc Pattyn


      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


      M 1 Reply Last reply
      0
      • L Luc Pattyn

        Martijn Groen wrote:

        Does anyone have any ideas?

        This guy[^] knows almost everything; the first hit is it. :)

        Luc Pattyn


        I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


        M Offline
        M Offline
        Martin Stevens
        wrote on last edited by
        #3

        The first hit it is NOT! I spent a fair bit of time Googling through this. Reasoning behind this is 1). the application code runs 100% fine 100% of the time on one user account that has admin privileges but not another admin account that is local (no domain or other policies exist affecting this). 2). The data inputted is not greater than the max size of the Access database column, I have analyzed the data source (every last row and column of every row) and no data is larger than the limit (if the data for a column was too large then the code would not work fine with the exact same data as it did on the first user account) 3). There is a string limiter function that has been tested and it is not possible for the data that gets passed onto this insert code to exceed the limit because it will chop it off at the allowed limit at code level this is actually well below the limit of the columns in the access database. I just regret this application has to have a shitty Access backend. I would have been done and dusted and had the bugs ironed out weeks ago had been on a proper database server backend. M:( Access sometimes sux

        1 Reply Last reply
        0
        • M Martin Stevens

          Hi I’m having some problems with a small vb.net application I wrote that inserts data into an Access database. When I run the application as my self it works comepletely fine on the Windows 2003 server or my desktop XP box. But when I run it under a local admin account on the Win 2003 server box it does not work and spits our the following error for each insert. “The field is too small to accept the amount of data you attempted to add.” The bit I’m having a difficult time understand is why it works under my logon and not a local server logon. There are no domain policies or restrictions in place over the server or local account function on the server. It seems to have something to do with jet/eledb. It is not possibly for the data to be to large because; 1). I’ve got a string limit function which chops of anything larger that what the field should be and this is far less than the Access DB memo field that most columns are set at. 2). I’ve done a thorough analysis of the data and none if it exceeds the maximum column size. My vb.net code it fairly typical…… Try Dim ConnectString, SelectStatement As String Dim Connect As OleDb.OleDbConnection = New OleDb.OleDbConnection ConnectString = (My.Settings("Access_db_tests")) SelectStatement = "INSERT INTO test_information (pk_test_information, department_name)" Connect = New OleDb.OleDbConnection(ConnectString) Dim Cmd As New OleDb.OleDbCommand(SelectStatement, Connect) With Cmd.Parameters .Add(New OleDb.OleDbParameter("@parameter_pk_test_information", pk_test_information)) .Add(New OleDb.OleDbParameter("@parameter_department_name", department_name)) End With Connect.Open() Cmd.ExecuteNonQuery() Connect.Close() Connect.Dispose() Catch Ex As Exception Dim details As String = "pk_test_information = " & pk_test_information & _ " insert_row_to_Access_database - error message >> " & Ex.Message log_exception(details) End Try Does anyone have any ideas? Any feedback would be much appreciated. M:)

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Change your OleDbParameter creation code to explicitly define the fields being sent as paramters, such as field type and width. Do not rely on the OldDbParameter class to use its defaults like you're doing now.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008
          But no longer in 2009...

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups