本文介绍了错误:无法在晶体报告加载时从数据库[供应商代码6550]检索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 1)我正在使用VS.Net 2005程序加载一个水晶报告(CR XI R2),它通过存储过程从Oracle 10gR2数据库中检索数据。加载报告时,提示以下错误:无法从数据库中检索数据。详细信息:[数据库供应商代码:6650] 无法从数据库中检索数据。详细信息:[数据库供应商代码:6650] 无法从数据库中检索数据。文件C中的错误:\ DOCUME~1 \ ADMIN~1 \ LOCALS~1 \Temp \OF001 {92D .. ..89E3} .rpt:无法从数据库中检索数据。详细信息:[数据库供应商代码:6650] 2)事实上,我可以成功运行独立的Crystal报表我也可以成功运行sqlplus中的存储过程。因此,我认为VS.Net 2005中存在一些问题。 3)我试图在VS.Net目录中执行存储过程,并假设将数据返回给游标。但是游标返回Nothing并且没有提示异常。 这是代码VS.Net: Dim obj As Object Dim connV As New Oracle Connection(ConnStr) Dim cmd As新的OracleCommand() 尝试如果connV.State = ConnectionState.Closed那么connV.Open() cmd.Connection = connV cmd.CommandText =" OFRPT_SPM.OF001" cmd.CommandType = CommandType.StoredProcedureHi All,1) I am using VS.Net 2005 program to load a crystal report (CR XI R2) which retrieve data from Oracle 10gR2 database through a stored procedure.When the report loads, the following error prompted:    Failed to retrieve data from the database.    Details: [Database Vendor Code: 6650]    Failed to retrieve data from the database.    Details: [Database Vendor Code: 6650]    Failed to retrieve data from the database.    Error in File C:\DOCUME~1\ADMIN~1\LOCALS~1\Temp\OF001 {92D....89E3}.rpt:    Failed to retrieve data from the database.    Details: [Database Vendor Code: 6650]2) In fact, I can run the crystal report standalone successfully and I can also run the stored procedure in sqlplus successfully. Therefore, I think there is some problems in the VS.Net 2005.3) I've tried to execute the stored procedure in VS.Net directory and it supposes to returns data to a cursor. However the cursor returns Nothing and no exception was prompted.Here is the codein VS.Net:        Dim obj As Object        Dim connV As New Oracle Connection(ConnStr)        Dim cmd As New OracleCommand()        Try            If connV.State = ConnectionState.Closed Then connV.Open()            cmd.Connection = connV            cmd.CommandText = "OFRPT_SPM.OF001"            cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add(" P_ORG_CODE",OracleType.VarChar,10).Value = Me.TxtBox1.Text cmd。 Parameters.Add(" P_STOCK_CODE_FROM",OracleType.VarChar,10).Value = Me.TxtBox2.Text cmd.Parameters.Add(" P_STOCK_CODE_TO",OracleType.VarChar,10).Value = Me.TxtBox3。文字 cmd.Parameters.Add(" P_TRANS_DATE_FROM&quo t;,OracleType.DateTime,10).Value = Me.DTP.Value cmd.Parameters.Add(" P_TRANS_DATE_TO",OracleType.DateTime,10).Value = Me.DTP2.Value cmd。 Parameters.Add(" P_SUB_INV",OracleType.VarChar,2000).Value = Me.TxtBox4.Text cmd.Parameters.Add(" P_CURSOR",OracleType.Cursor).Direction = ParameterDirection.Output            cmd.Parameters.Add("P_ORG_CODE", OracleType.VarChar, 10).Value = Me.TxtBox1.Text            cmd.Parameters.Add("P_STOCK_CODE_FROM", OracleType.VarChar, 10).Value = Me.TxtBox2.Text            cmd.Parameters.Add("P_STOCK_CODE_TO", OracleType.VarChar, 10).Value = Me.TxtBox3.Text            cmd.Parameters.Add("P_TRANS_DATE_FROM", OracleType.DateTime, 10).Value = Me.DTP.Value            cmd.Parameters.Add("P_TRANS_DATE_TO", OracleType.DateTime, 10).Value = Me.DTP2.Value            cmd.Parameters.Add("P_SUB_INV", OracleType.VarChar, 2000).Value = Me.TxtBox4.Text            cmd.Parameters.Add("P_CURSOR", OracleType.Cursor).Direction = ParameterDirection.Output cmd.ExecuteNonQuery()/ * return 0 * /            cmd.ExecuteNonQuery() /* return 0 */ obj = cmd.Parameters(" P_CURSOR")。Value / * return Nothing * /            obj = cmd.Parameters("P_CURSOR").Value /* return Nothing */ Catch ex As Exception MsgBox(ex.Message& Chr(13)& Chr(10)& ex.StackTrace) End Try 这里是存储过程的模式:参数名称输入/输出默认值? ------------ ------------------ ----------------------- ------ --- ----- P_ORG_CODE VARCHAR2 IN P_STOCK_CODE_FROM VARCHAR2 IN P_STOCK_CODE_TO VARCHAR2 IN P_TRANS_DATE_FROM DATE IN P_TRANS_DATE_TO DATE in P_SUB_INV VARCHAR2 in P_CURSOR REF CURSOR OUT 我发现有些人也有使用存储过程通过VS.Net水晶报表一起同样的问题。然而,他们似乎无法找到解决方案。希望有人在这里可以提供帮助。 谢谢和问候, Cherry        Catch ex As Exception            MsgBox(ex.Message & Chr(13) & Chr(10) & ex.StackTrace)        End TryAnd here is the schema of stored procedure:    Argument Name                  Type                    In/Out Default?    ------------------------------ ----------------------- ------ --------    P_ORG_CODE                     VARCHAR2                IN    P_STOCK_CODE_FROM              VARCHAR2                IN    P_STOCK_CODE_TO                VARCHAR2                IN    P_TRANS_DATE_FROM              DATE                    IN    P_TRANS_DATE_TO                DATE                    IN    P_SUB_INV                      VARCHAR2                IN    P_CURSOR                       REF CURSOR              OUTI found some people also having same problem with using stored procedure together with crystal report through VS.Net. However, they seems not able to find the solution.Hope someone here can help.Thanks and Regards,Cherry推荐答案 大家好,对于上面提到的第2点,我终于发现select命令应该通过oracle数据适配器将结果填充到数据集来执行。所以我现在可以执行sp并从游标中获取结果。另外,我还发现如果我没有在VS.Net中设置数据库登录信息,而是在加载报告时通过登录promt输入这些信息,报告可以显示成功。显然,数据库登录有问题,我使用SetDataBaseLogon将userid,password,servername和database name传递给报表。 有谁能告诉我如何正确地将这些信息传递给Oracle 10g数据库的水晶报告? 谢谢和问候, CherryHi All,for point 2 stated above, I finally found that the select command should execute by filling result into dataset by a oracle data adapter.So I can now execute the sp and get the result from cursor.Besides, I also found that if I don't set the data base logon info in VS.Net and instead enter these information through the login promt when the report loaded, the report can show up successfully.Obviously, there is something wrong with database login and I use SetDataBaseLogon to pass userid, password, servername and database name to the report. Can anyone show me how pass these information correctly to crystal report for Oracle 10g database?Thanks and Regards,Cherry 这篇关于错误:无法在晶体报告加载时从数据库[供应商代码6550]检索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-21 02:55