代码的反向功能 [英] Reverse function of the code

查看:49
本文介绍了代码的反向功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我写了一个代码,返回富文本框的rtf,然后将其保存在ms访问备忘字段中.现在,我正在检索此rtf,并希望将其显示在RTF文本框中.但是其说法文件格式无效.我正在使用以下代码:如何显示它

Hello all,
I have written a code that returns the rtf of rich text box then i save it in ms access memo field. now i am reetrieving this rtf and want to display it into rich text box .but its saying file format is not valid .I am using following code: how to display it

string[] strQ = splitterPart(rtbQuestion.Rtf.ToString(), 50000);
if (strQ.Length == 1)
{
    string sqlcommand = "update Questions set Questions.Question ='" + 
                        rtbQuestion.Rtf.Replace("'", "''") + 
                        "' where Questions.QuestionNo=" + 
                        Convert.ToInt32(Qno.Text) + ";";
    DbOperation.InsertOrUpdateQuery(sqlcommand, Myconn);
}
else
{
    for (int iIndex = 0; iIndex < strQ.Length - 1; iIndex++)
    {
        // Question rtbQuestion.Rtf.Replace("'", "''")
        Sqlcommand = "";
        Sqlcommand = " update questions set Questions.Question = '" + 
                     strQ[iIndex].Replace("'", "''") + 
                     "' where Questions.QuestionNo="; + 
                     Convert.ToInt32(Qno.Text) + 
                     ";";
        DbOperation.InsertOrUpdateQuery(Sqlcommand, Myconn);
    }
}

private string[] splitterPart(string strSource, int size)
{
    int arrSZ = strSource.Length / size;
    string[] result = new string[arrSZ + 1];
    int jStartIdx = 0, jEndIdx = size - 1;
    for (int i = 0; i <= arrSZ && jEndIdx < strSource.Length; i++)
    {
        result[i] = strSource.Substring(jStartIdx, size);
        jStartIdx = jEndIdx + 1;
        jEndIdx = jEndIdx + size - 1;
    }
    if (jStartIdx - 1 < strSource.Length)
    {
    }
    return result;
}

推荐答案

您使用哪种数据类型存储rtf数据?
您可能需要更改它.

请参见此处 [ ^ ].
What data type are you using for storing the rtf data?
You will probably need to change it.

See here[^].


这篇关于代码的反向功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆