本文介绍了运行时错误'2147217887(80040e21)字符串数据,右截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!         我的宏(outlook)有问题。我在回复电子邮件时会返回错误。        请参阅下面的代码块。        请帮帮我。 问候, Jerzon Sub ProcessWsubject(ByRef pMailItem As Outlook.MailItem) Dim vSQL As New ADODB.Connection Dim vCMD As New ADODB.Command Dim vSenderAddress As String vSenderAddress = GetSenderEmail( pMailItem.SenderEmailAddress) '打开到SQL Server的连接 vSQL.Open(mSQLConStr)使用vCMD .ActiveConnection = vSQL .CommandType = adCmdStoredProc .CommandText =" spEmailWRSub" .CommandTimeout = 0 .Parameters(" @ UIDL")。Value = pMailItem.EntryID .Parameters(" @ DateSend")。Value = pMailItem.SentOn .Parameters(" @ SenderEmail")。Value = vSenderAddress .Parameters(" @ Recipient")。Value =" JOBarbacena@neltex.com" .Parameters(" @vSubject")。Value = pMailItem.Subject .Parameters(" @ EmailBody")。Value = pMailItem.Body .Parameters(" @ Remarks" ).Value ="" .Execute ---调试后指向此错误 结束 vSQL.Close End Sub 解决方案 Hi, I have a problem with my macro(outlook). It return an error when I'm replying an email. Kindly refer to the code block below. Please help me.Regards,JerzonSub ProcessWsubject(ByRef pMailItem As Outlook.MailItem) Dim vSQL As New ADODB.Connection Dim vCMD As New ADODB.Command Dim vSenderAddress As String vSenderAddress = GetSenderEmail(pMailItem.SenderEmailAddress) ' Open connection to SQL Server vSQL.Open (mSQLConStr) With vCMD .ActiveConnection = vSQL .CommandType = adCmdStoredProc .CommandText = "spEmailWRSub" .CommandTimeout = 0 .Parameters("@UIDL").Value = pMailItem.EntryID .Parameters("@DateSend").Value = pMailItem.SentOn .Parameters("@SenderEmail").Value = vSenderAddress .Parameters("@Recipient").Value = "JOBarbacena@neltex.com" .Parameters("@vSubject").Value = pMailItem.Subject .Parameters("@EmailBody").Value = pMailItem.Body .Parameters("@Remarks").Value = "" .Execute --- the error pointing this after debug End With vSQL.CloseEnd Sub 解决方案 这篇关于运行时错误'2147217887(80040e21)字符串数据,右截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!