Results 1 to 2 of 2

Thread: Data adapter limit of 20 characters???

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Data adapter limit of 20 characters???

    I have the following code.

    VB Code:
    1. Dim cn3 As New OleDb.OleDbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;" _
    2.                     & "Persist Security Info=False;" _
    3.                     & "Initial Catalog=mcclure credit cards;" _
    4.                     & "UID=;PWD=;" _
    5.                     & "Data Source=Server7")
    6.         cn3.Open()
    7.  
    8.         Dim datAdapt3 As New OleDb.OleDbDataAdapter("Select * From CustTransactions", cn3)
    9.         Dim commBuild3 As New OleDb.OleDbCommandBuilder(datAdapt3)
    10.         Dim datSet3 As New Data.DataSet
    11.         Dim datRow3 As Data.DataRow
    12.  
    13.         datSet3.Clear()
    14.         datAdapt3.Fill(datSet3, "CustTransactions")
    15.  
    16. datRow3 = datSet3.Tables("CustTransactions").NewRow
    17.  
    18. datRow3.Item("Product") = Trim(DatRead1.Item("Product"))
    19.  
    20. datSet3.Tables("CustTransactions").Rows.Add(datRow3)
    21.             datAdapt3.Update(datSet3, "CustTransactions")

    The SQL data dtarow3.item("Product") is a varchar field set at 50 characters.

    When this code runs with data more than 20 characters long, I get the following error.

    The statement has been terminated. String or binary data would be truncated.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.OleDb.OleDbException: The statement has been terminated. String or binary data would be truncated.

    Is there a way to make it so this datrow field will except data great than 50 characters?

    Thanks
    Last edited by indydavid32; Jul 2nd, 2004 at 10:20 AM.
    David Wilhelm

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    The SQL data dtarow3.item("Product") is a varchar field set at 50 characters.

    I imagine you used the DataAdapter wizard and have a strongly-typed dataset, correct?

    In that case, the dataAdapter built the dataset off what you had in the database for a field size, so if it was 50 characters, it strongly-typed the dataset to 50 characters for that column.

    Change the size of the field, rebuild the dataset.

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