Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法在数据库中插入长文本_C#_Jquery_Asp.net_Wcf_Fckeditor - Fatal编程技术网

C# 无法在数据库中插入长文本

C# 无法在数据库中插入长文本,c#,jquery,asp.net,wcf,fckeditor,C#,Jquery,Asp.net,Wcf,Fckeditor,我通过jquery在asp.net应用程序中的应用程序中拥有ckeditor 它在本地工作正常。它在数据库中插入数据并不重要 无论文本的长度如何。但当我在live after上插入数据时 将构建放在服务器上 它不是在保存数据,当我缩短它的长度时,它就是在保存数据。我使用WCF服务插入此文本 请在这方面提供帮助 期待听到同样的消息。Oracle DB接受4000个字符作为输入字符串的最大长度(不是数据类型)。 i、 e,您最多需要发送4000个字符作为值。 解决方案: 如果您使用的是ASP.NET

我通过jquery在asp.net应用程序中的应用程序中拥有
ckeditor

它在
本地
工作正常。它在数据库中插入数据并不重要 无论文本的长度如何。但当我在live after上插入数据时 将构建放在服务器上

它不是在保存数据,当我缩短它的长度时,它就是在保存数据。我使用WCF服务插入此文本

请在这方面提供帮助


期待听到同样的消息。

Oracle DB接受4000个字符作为输入字符串的最大长度(不是数据类型)。 i、 e,您最多需要发送4000个字符作为值。 解决方案: 如果您使用的是ASP.NET,请在将列类型更改为CLOB后尝试使用此函数,使其大小达到4GB:

 Public Shared Function AssignStringToCLOB(ByVal targetString As String, ByVal myConnection As OracleConnection) As OracleLob
    Dim _tempCommand As New OracleCommand()
    _tempCommand.Connection = myConnection
    _tempCommand.Transaction = _tempCommand.Connection.BeginTransaction()
    _tempCommand.CommandText = "DECLARE A " + OracleType.Clob.ToString() + "; " + "BEGIN " + "DBMS_LOB.CREATETEMPORARY(A, FALSE); " + ":LOC := A; " + "END;"
    Dim p As OracleParameter = _tempCommand.Parameters.Add("LOC", OracleType.Clob)
    p.Direction = ParameterDirection.Output

    _tempCommand.ExecuteNonQuery()

    Dim _tempCLOB As OracleLob = CType(p.Value, OracleLob)
    If targetString <> String.Empty Then
        Dim _bytesArray As Byte() = Text.Encoding.Unicode.GetBytes(targetString)
        _tempCLOB.BeginBatch(OracleLobOpenMode.ReadWrite)
        _tempCLOB.Write(_bytesArray, 0, _bytesArray.Length)
        _tempCLOB.EndBatch()
    End If

    _tempCommand.Transaction.Commit()
    Return _tempCLOB
End Function
公共共享函数将stringtoclob(ByVal targetString作为String,ByVal myConnection作为OracleConnection)分配为OracleLob
dimu tempCommand作为新的OracleCommand()
_tempCommand.Connection=myConnection
_tempCommand.Transaction=_tempCommand.Connection.BeginTransaction()
_tempCommand.CommandText=“声明A”+OracleType.Clob.ToString()+”;“+”开始“+”DBMS_LOB.CREATETEMPORARY(A,FALSE);“+”:LOC:=A;“+”结束
Dim p As OracleParameter=_tempCommand.Parameters.Add(“LOC”,OracleType.Clob)
p、 方向=参数方向。输出
_tempCommand.ExecuteNonQuery()
Dim_tempCLOB作为OracleLob=CType(p.Value,OracleLob)
如果targetString.String为空,则
Dim _字节数组作为字节()=Text.Encoding.Unicode.GetBytes(targetString)
_tempCLOB.BeginBatch(OracleLobOpenMode.ReadWrite)
_tempCLOB.Write(_bytesArray,0,_bytesArray.Length)
_tempCLOB.EndBatch()
如果结束
_tempCommand.Transaction.Commit()
返回_tempCLOB
端函数

并在打开与Oracle DB的连接后调用它以设置参数的值,这应该可以很好地工作。

您需要将服务器上相应列的数据类型设置为
nvarchar(max)
,错误出现在哪里?例如,这可能是因为某列没有合适的类型/宽度,但由于您提到了jQuery,这可能是因为您正在将其作为查询字符串参数传输,并且您的url太长(并且被服务器拒绝),可能您需要增加WCF中消息的最大大小: