473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error :string or binary data would be truncated ???

I loop myDatareader and insert the row into another datatable, as I update
the dataadaptor.
it return the above errors ??

drBranch = cmdBranch.ExecuteReader
dtSysBranchDept.BeginInit()
dgBranchDept.EndInit()
bmSysBranchDept.EndCurrentEdit()
Do While drBranch.Read
myDataRow = dtSysBranchDept.NewRow()
myDataRow.BeginEdit()
myDataRow.Item("branchid") = drBranch.Item("branchid")
myDataRow.item("deptid") = txtDeptId.Text
'MessageBox.Show(drBranch.Item("branchid")) <--- work fine
dtSysBranchDept.Rows.Add(myDataRow)
myDataRow.EndEdit()
Loop
Nov 21 '05 #1
2 3785
Hi Agnes,

Can you show the creation of that column "branchid" you are using?
Probably it has another type than the one you are reading.

Again why you are doing this while the fill does this automaticly.
(And there seems to be no noticeable performance difference because the
dataadapter.fill is using as well the datareader)

Cor
I loop myDatareader and insert the row into another datatable, as I update
the dataadaptor.
it return the above errors ??

drBranch = cmdBranch.ExecuteReader
dtSysBranchDept.BeginInit()
dgBranchDept.EndInit()
bmSysBranchDept.EndCurrentEdit()
Do While drBranch.Read
myDataRow = dtSysBranchDept.NewRow()
myDataRow.BeginEdit()
myDataRow.Item("branchid") = drBranch.Item("branchid")
myDataRow.item("deptid") = txtDeptId.Text
'MessageBox.Show(drBranch.Item("branchid")) <--- work fine
dtSysBranchDept.Rows.Add(myDataRow)
myDataRow.EndEdit()
Loop

Nov 21 '05 #2
Dear Cor,
I know what's wrong of my coding . In my drBranch.item("branchid") <--
it is char20. but in myDataRow. I define the field is char(10). That's why
there is any error.

myDataRow.Item("branchid") = drBranch.Item("branchid")
"Cor Ligthert" <no**********@planet.nl> ¦b¶l¥ó
news:O1**************@TK2MSFTNGP12.phx.gbl ¤¤¼¶¼g...
Hi Agnes,

Can you show the creation of that column "branchid" you are using?
Probably it has another type than the one you are reading.

Again why you are doing this while the fill does this automaticly.
(And there seems to be no noticeable performance difference because the
dataadapter.fill is using as well the datareader)

Cor
I loop myDatareader and insert the row into another datatable, as I update the dataadaptor.
it return the above errors ??

drBranch = cmdBranch.ExecuteReader
dtSysBranchDept.BeginInit()
dgBranchDept.EndInit()
bmSysBranchDept.EndCurrentEdit()
Do While drBranch.Read
myDataRow = dtSysBranchDept.NewRow()
myDataRow.BeginEdit()
myDataRow.Item("branchid") = drBranch.Item("branchid")
myDataRow.item("deptid") = txtDeptId.Text
'MessageBox.Show(drBranch.Item("branchid")) <--- work fine
dtSysBranchDept.Rows.Add(myDataRow)
myDataRow.EndEdit()
Loop


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: TZone | last post by:
Is there anything I can put in a stored procedure so instead of proc falling over because of "String or binary data would be truncated" the offending records are just truncated? Thanks for any...
3
by: RDRaider | last post by:
How can I find which record(s) cause this error: Server: Msg 8152, Level 16, State 9, Line 1 String or binary data would be truncated. The statement has been terminated. I have tried Profiler...
2
by: Jeff Magouirk | last post by:
Dear All, I have written an update trigger that should write a message to an audit table When I try to update any field in the table I recieve the following error message - Stirng or...
0
by: benh | last post by:
Does anyone have any insight into how Application Center Test handles binary data in a response body? My problem: I need some specific data from inside a PDF file that is coming down as the...
6
by: ~Maheshkumar.R | last post by:
The error i'm getting is as: > Server Error in '/' Application. > -------------------------------------------------------------------------- -- > String or binary data would be truncated. The...
0
by: dileepkumar | last post by:
I'm trying to save file data to sqlserver. file data is converted to sysyte.io.stream and passed through webservice and in Business layer i changed the stream to byte array and passed it as a...
1
by: skins96 | last post by:
Hello there, I know very little ASP, so I'm begging for help. The script was written by my predacessor.... I haven't made a single change to the script, but all of the suddent I started...
8
by: JJ | last post by:
This is slightly OT but .... When testing why my aspx page isn't returning the data as expected I decided to type directly into one of my SQL tables. (The column definitions are below). When...
6
by: fnoppie | last post by:
Hi, I am near to desperation as I have a million things to get a solution for my problem. I have to post a multipart message to a url that consists of a xml file and an binary file (pdf)....
2
by: sunkesula | last post by:
I update a field in the database that gives the last update time. The first time I edit the item it puts a value in this field. The second time the applications fails with The statement has...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.