G
Guest
dear :
i have the following problem:
string sAttachmentBody;
int nCount = 0;
int nMaxLineLength = 77;
//sAttachmentBody.Length may reaches (560960 chars)
for(int i=0 ; i < sAttachmentBody.Length ; i++)
{
if(nCount % nMaxLineLength == 0 )
{
try
{
sAttachmentBody = sAttachmentBody.Insert(i,"\n\r");
}
catch(Exception ex)
{
wr = new System.IO.StreamWriter("C:\\stringerror.txt");
wr.WriteLine("Message = " + ex.Message );
wr.WriteLine("Stack = " + ex.StackTrace );
wr.Close();
}
nCount = 0;
}
}
the exception
Stack = at System.String.Insert(Int32 startIndex, String value)
at Utility.Email.SetAttachmentBody(String sAttachmentBody)
the exception occured ONLY if the length is to big , is there a replacement
for insert function because as I wrote the length may reaches millions
i have the following problem:
string sAttachmentBody;
int nCount = 0;
int nMaxLineLength = 77;
//sAttachmentBody.Length may reaches (560960 chars)
for(int i=0 ; i < sAttachmentBody.Length ; i++)
{
if(nCount % nMaxLineLength == 0 )
{
try
{
sAttachmentBody = sAttachmentBody.Insert(i,"\n\r");
}
catch(Exception ex)
{
wr = new System.IO.StreamWriter("C:\\stringerror.txt");
wr.WriteLine("Message = " + ex.Message );
wr.WriteLine("Stack = " + ex.StackTrace );
wr.Close();
}
nCount = 0;
}
}
the exception
Stack = at System.String.Insert(Int32 startIndex, String value)
at Utility.Email.SetAttachmentBody(String sAttachmentBody)
the exception occured ONLY if the length is to big , is there a replacement
for insert function because as I wrote the length may reaches millions