Monday, March 12, 2012

MSDE & SQL2000

I am developing a Crystal Reports App in VS2005 (VB). I was originally working on an XP machine with MSDE and stored procedures where it worked fine.

I then transferred the development to a Win2003 machine with SQL2000 and am now getting the following error;

Failed to open a rowset. Description: 'Get_Calls_By_MLO_Date' expects parameter '@.DT1' which was not supplied. Plus some other error detail.

Here is the SP.

CREATE PROCEDURE Get_Calls_By_MLO_By_Date
@.DT1 datetime,
@.DT2 datetime
AS
SELECT MLO, CallNo, DT, Type FROM Actions
WHERE dt >= @.DT1 AND dt <= @.DT2 AND ActionID=1ORDER BY MLO, DT
GO

If I transfer everything back to the XP machine it works fine.

Any ideas?

Thanks

Terry.

How did you call the stored procedure that causes the error?|||

Hi,

It's called from the Crystal Report object. The function below accepts 2 parameters; 1. The report viewer and 2. (optional) a hashtable with the key/value pairs being the parameter info e.g. Key=@.DT1, Value = 13/01/2006 12:00:01 AM

As I mentioned in the original post, this works fine on the XP box but not the Win2003. The are a number of reports; some accept parameters (all of which appear to fail with the same error) and others that don't, all of which work as expected. Other than the OS, and SQL as opposed to MSDE the only other differerence I can think of is the copy of VS2005.

Thanks.

Private Function LoadReport(ByVal ReportNameAs String, _ByVal ViewerAs CrystalDecisions.Windows.Forms.CrystalReportViewer, _Optional ByVal ParametersAs Hashtable =Nothing)As Boolean Dim rptAs New ReportDocumentDim pvCollAs New CrystalDecisions.Shared.ParameterValues' Objects used to set the proper database connection informationDim tbCurrentAs CrystalDecisions.CrystalReports.Engine.TableDim tliCurrentAs CrystalDecisions.Shared.TableLogOnInfoDim pdValAs New CrystalDecisions.Shared.ParameterDiscreteValueTry Dim appPathAs String = Application.ExecutablePath appPath = appPath.Substring(0, appPath.LastIndexOf("\") + 1)Dim fileExistsAs Boolean = false fileExists = My.Computer.FileSystem.FileExists(appPath &"Reports\" & ReportName)If fileExistsThen rpt.Load(appPath &"Reports\" & ReportName)Else MsgBox("Cannot locate report file", MsgBoxStyle.Critical,"Load Error")     pvColl =Nothing    pdVal =NothingExit Function End If For Each tbCurrentIn rpt.Database.Tables tliCurrent = tbCurrent.LogOnInfoWith tliCurrent.ConnectionInfo .ServerName = ServerName .UserID ="" .Password ="" .DatabaseName = My.Settings.DBName.ToStringEnd With tbCurrent.ApplyLogOnInfo(tliCurrent)Next tbCurrentIf Not IsNothing(Parameters)Then Dim myEnumAs IDictionaryEnumerator = Parameters.GetEnumeratorWhile myEnum.MoveNext pvColl.Clear() pdVal.Value = myEnum.Value pvColl.Add(pdVal) rpt.DataDefinition.ParameterFields(myEnum.Key).ApplyCurrentValues(pvColl)End While End If Viewer.ReportSource = rptCatch ExpAs LoadSaveReportException MsgBox("Report " & ReportName &" not found.", _ MsgBoxStyle.Critical,"Load Report Error")Catch ExpAs Exception MsgBox(Exp.Message, MsgBoxStyle.Critical,"General Error")Finally pvColl =Nothing pdVal =Nothing End Try End Function
|||

Thanks for the help. The problem is a crystal reports one and is detailed here

http://support.businessobjects.com/library/kbase/articles/c2017367.asp

No comments:

Post a Comment