|
-
Jul 1st, 2004, 10:17 AM
#1
Thread Starter
Fanatic Member
Data adapter limit of 20 characters???
I have the following code.
VB Code:
Dim cn3 As New OleDb.OleDbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;" _
& "Persist Security Info=False;" _
& "Initial Catalog=mcclure credit cards;" _
& "UID=;PWD=;" _
& "Data Source=Server7")
cn3.Open()
Dim datAdapt3 As New OleDb.OleDbDataAdapter("Select * From CustTransactions", cn3)
Dim commBuild3 As New OleDb.OleDbCommandBuilder(datAdapt3)
Dim datSet3 As New Data.DataSet
Dim datRow3 As Data.DataRow
datSet3.Clear()
datAdapt3.Fill(datSet3, "CustTransactions")
datRow3 = datSet3.Tables("CustTransactions").NewRow
datRow3.Item("Product") = Trim(DatRead1.Item("Product"))
datSet3.Tables("CustTransactions").Rows.Add(datRow3)
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
-
Jul 7th, 2004, 11:36 AM
#2
I wonder how many charact
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|