Results 1 to 2 of 2

Thread: OleDbException with OleDbParameters

  1. #1

    Thread Starter
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Question OleDbException with OleDbParameters

    I'm getting the following exception when i try and insert data into an excel sheet using ado. I've tried changing the OleDbType but nothing seems to work and was hoping that someone could maybe tell me what i'm doing wrong or if it's because an excel cell is set to hold 255 characters? if so why can i paste the data into an excel sheet?



    A first chance exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll
    System.Data.OleDb.OleDbException: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.
    at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
    at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
    at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
    at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
    at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
    at DsgSave.FileOperation.PerfomAdoExcelWrite(String filename, Int32 size, DataSet ds) in C:\Documents and Settings\derekklingman\My Documents\Visual Studio 2005\Projects\CDEnvironment\DsgSave\FileOperation.vb:line 277

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: OleDbException with OleDbParameters

    Is that second argument to PerformAdoExcelWrite the size of the string parameter? If so, what value are you passign and how long is the string?

    Also, note that ADO and ADO.NET are not the same thing. If you say ADO people will assume that you mean the pre-.NET version.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Click Here to Expand Forum to Full Width