using the following code but some times(not all the time) i get the above error can u help
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)
anyone help me for this problem..
Code block added, HTML sorted - OriginalGriff.[/edit]
This error is a direct indication of the fact, that one(or several) of your parameters has length greater that the size of the corresponding data column.
Find out which or the parameters has the excessive length, and, either reduce its length, or change the column data size in your table.
Firstly don't do it that way - you are wide open for an SQL Injection attackm which could (accidentally or deliberately) delete your database.
Look at SqlCommand.Parameters.AddWithValue for how to do it properly.
That will probably also cure your problem: The chances are that some of the content of one or more of your Host, UserAgent, Browser, etc. variables holds a character or characters that the SQL does not like. Changing to parametrised queries will get rid of the problem, if so.
Forgot the WithValue bit of SqlCommand.Parameters.AddWithValue: SqlCommand.Parameters.Add has been depreciated - OriginalGriff[/edit]
Edited 11-Nov-10 5:17am
i give you the solution for that so plz go to the database and change the field data type then problem is solved check it.
It seems to me that at least one of the columns in the Table is set for fewer characters than what is being entered!
or you have Log Tables, so that your Primary Table (The table you are currently inserting, Updating or Deleting its data) columns Data Type length do not match The Log Table(s) columns Data Type length. So, match between those tables!
Please check your procedure paramaeter size or the column size defined in the table defination. here the problem with that is your data size exceed the variable declare in the procedure or the column size in the table
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)