473,382 Members | 1,814 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,382 software developers and data experts.

String or binary data would be truncated. The statement has been terminated

String or binary data would be truncated. The statement has been terminated.

I'm using the following code but some times(not all the time) i get the above error can u help


Expand|Select|Wrap|Line Numbers
  1. Dim ST As String = "update MCVISITORS SET HOSTADDRESS='" & Host & "',USERAGENT='" & UserAgent & "',BROWSER='" & Browser & "',CRAWLER='" & Crawler & "', URL='" & URL1 & "', REFERRER='" & Referrer & "', VISITCOUNT='" & VisitCount & "', ORIG_REFERER='" & OriginalReferrer & "', ORIG_URL='" & OriginalURL & "', PAGE_COUNT='" & pageno & "', TOTALTIME='" &; ttime & "' WHERE VISITORID='" & vid & "'"

dbcommand = New SqlCommand(ST, dbconnection)
dbcommand.ExecuteNonQuery()
dbconnection.Close()

anyone help me for this problem..

regards,
Sasi
Nov 11 '10 #1
2 3218
code green
1,726 Expert 1GB
You are sending a value to a field that exceeds the size allocated for that field.
Address is too long or something like that
Nov 11 '10 #2
jeffstl
432 Expert 256MB
code green is correct. To clarify you need to check the actual column properties in the table MCVISITORS on the database.

If you have the power a quick fix would be to just increase the number of characters you can save in those columns ;)

But likely they were set for a reason, so a better option might be checking the length of the problem data before you pass it into your SQL, and if its too long then wherever that data is coming from needs to be re-checked or changed.

If the table columns have the default character length settings, and were never even looked at when the table was designed, then now is probably a good time to check what they should be, and set them up, if it doesnt matter or the length of your data is always going to be unknown then set them to the maximum I guess :)
Nov 19 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

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...
1
by: Agnes | last post by:
my form got over 30 textbox, as I addnew() and update the record, it said "string & binary data unable trunctated" and that record didn't save in database I used Try catch to check the error, It...
6
by: as400tips | last post by:
I have a Binary Data file (Packed Decimal and ASCII mixed) and would like to convert into ASCII (readable) file. How to do it in C#? Thanks.
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...
6
by: dtarczynski | last post by:
Hello. I have problem when i inserting strings with special characters into MS SQL 2005 database for example:...
7
Coldfire
by: Coldfire | last post by:
i am having error ....details are ASP.Net application...in which I have a textbox <asp:TextBox ID="Other" TextMode=SingleLine CssClass="serviceBox" Width="250" Height="45" Runat="server"...
1
by: dreamer247 | last post by:
hii My insert quary is giving an error "Server: Msg 8152, Level 16, State 9, Line 1 String or binary data would be truncated. The statement has been terminated. " What may be the...
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...
2
by: Elijicity | last post by:
Please I am not an expert but i need detailed reports on how to solve this problem String or binary data would be truncated. The statement has been terminated. I am trying to register online and it...
1
by: kefelegn | last post by:
i am using sql 2005 and asp.net and code behind C# when i try to insert data to table it says "String or binary data would be truncated. The statement has been terminated." any one help me pls be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.