Advanced VB.Net

Moderators: None (Apply to moderate this forum)
Number of threads: 254
Number of posts: 388

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
NVarChar data type Posted by lionb on 10 Nov 2009 at 7:30 AM
Foloowing code works perfectrly in VB.NET. However, when I tried to use it as VBScript with Integration Services, I got Error message 'String or binary data would be truncated. The statement has been terminated'. It is about NVarChar data type (see blue line of code).

SQL Server 2008 Parameter

@Body NVARCHAR(MAX)

 
 Dim cmdInsert = New SqlClient.SqlCommand("usp_INSERT_UPDATE_ARTICLE_DATA_MIGRATION", insertConn)
            cmdInsert.CommandType = CommandType.StoredProcedure

            cmdInsert.Parameters.Add("@Title", SqlDbType.VarChar, 4000).Value = "testing"
            cmdInsert.Parameters.Add("@Body", SqlDbType.NVarChar).Value = stringAdd
            cmdInsert.Parameters.Add("@ArticleDate", SqlDbType.DateTime).Value = Now()

            cmdInsert.ExecuteNonQuery()

            cmdInsert.Dispose()
Any idea how to fix this problem? Again it is about Integration Services VBScript task 
Report
Re: NVarChar data type Posted by lionb on 12 Nov 2009 at 7:41 AM
Never mind. It fixed.
Report
Re: NVarChar data type Posted by James on 25 Mar 2010 at 1:51 PM
Have you tried explicitly specifying the max in your parameter declaration?

@Body nvarchar(4000)

I had an issue with this datatype being declared as "MAX" because of a legacy issue.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.