none
ArgumentException was unhandled by user code

    질문

  • I am training create load file using SQL and MDX queries result in Visual Studio web application. My procedure is succeeded in all the levels except assigning the ADOMD.Source = “My MDX Query” it is throwing an exception  ”Argument exception was unhandled by user code”

    Thanks & Regards, Santhosh

    2012년 2월 21일 화요일 오전 9:35

모든 응답

  • Hello,

    To have a definition of ArgumentException, i would suggest to have a look at

    http://msdn.microsoft.com/en-us/library/system.argumentexception(v=vs.90).aspx 

    "method is invoked and at least one of the passed arguments does not meet the parameter specification of the called method"

    Very often, it is the case when a method has a parameter defined as numeic and the value passed for this parameter is a string or a DateTime

    Don't hesitate to post again for more help or explanations.

    Have a nice day


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

    2012년 2월 22일 수요일 오후 11:24
  • Hi Papy,
    Thanks for the reply. I am declaring variable as Strings for query as well as for parameters not sure why is this exception popping. Below is the script for your reference. Let me know if am going wrong.

    Dim conADODB As New ADODB.Connection
    Dim csADOMD As New ADOMD.Cellset
    Dim tmpYear, tmpQtr, tmpMonth, tmpWeek As String
    Dim sMDXBacklog As String

    conADODB.Provider = "MSOLAP"
    conADODB.Open("DataSource=Server;Provider=MSOLAP.4;Initial Catalog=DB;")
    tmpYear = "2012"
    tmpQtr = "Qtr 1"
    tmpMonth = "Feb"
    tmpWeek = "Week 7"
    sMDXBacklog = "WITH MEMBER [Measures].[ISC - AMS Backlog Total ($000)1]  AS " _
    & " (([Measures].[Actual],    [Metric].[ISC - AMS Backlog Total (Units)]) * ([Measures].[Actual],[Metric].[ISC - AMS Average Invoice Price]))/1000" _
    & " MEMBER [Measures].[ISC - AMS Backlog Workable/Shippable ($000)1] AS " _
    & " (([Measures].[Actual],    [Metric].[ISC - AMS Backlog Workable/Shippable (Units)]) * ([Measures].[Actual],[Metric].[ISC - AMS Average Invoice Price]))/1000" _
    & " MEMBER [Measures].[ISC - AMS Backlog Total ($000)2]  AS " _
    & " ([Measures].[Actual],    [Metric].[ISC - AMS Backlog Total ($000)])" _
    & " MEMBER [Measures].[ISC - AMS Backlog Workable/Shippable ($000)2] AS " _
    & " ([Measures].[Actual],    [Metric].[ISC - AMS Backlog Workable/Shippable ($000)])" _
    & " MEMBER [Measures].[ISC - AMS Backlog Total ($000)]  AS " _
    & " (Iif((([Measures].[ISC - AMS Backlog Total ($000)1] -  [Measures].[ISC - AMS Backlog Total ($000)2])>=1),[Measures].[ISC - AMS Backlog Total ($000)1],Null))" _
    & " MEMBER [Measures].[ISC - AMS Backlog Workable/Shippable ($000)]  AS " _
    & " (Iif((([Measures].[ISC - AMS Backlog Workable/Shippable ($000)1] -  [Measures].[ISC - AMS Backlog Workable/Shippable ($000)2])>=1),[Measures].[ISC - AMS Backlog Workable/Shippable ($000)1],Null))" _
    & " SELECT NON EMPTY Crossjoin(CROSSJOIN({[Service Line].[All Service Line].[AMS].[Aftermarket - Mechanical]," _
    & " [Service Line].[All Service Line].[AMS].[Aftermarket - Avionics & Electronics]," _
    & " [Service Line].[All Service Line].[AMS].[Aftermarket - Distribution]},{[Site].[Site].Members}),  CROSSJOIN({[Group].[All Group].[TAT].Children}," _
    & " {[Measures].[ISC - AMS Backlog Total ($000)],[Measures].[ISC - AMS Backlog Workable/Shippable ($000)]})) " _
    & " ON Rows, {[Period].[All Period].[" & tmpYear & "].[" & tmpQtr & "].[" & tmpMonth & "].[" & tmpWeek & "]} " _
    & " ON COLUMNS FROM [Monthly]"
    csADOMD.ActiveConnection = conADODB
    csADOMD.Source = sMDXBacklog
    csADOMD.Open()


    Thanks & Regards, Santhosh

    2012년 2월 23일 목요일 오전 4:12
  • Hello ,

    Please, could you tell us if your problem is occuring  in the line

    csADOMD.Source = sMDXBacklog   ( at the end of your code ) ?

    If yes, please, could you display the value of sMDXBacklog and tell us how it is loaded ?

    Have a nice day


    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

    2012년 3월 2일 금요일 오후 3:10
  • Hi Papy,

    Yes it is in that line when it try to assign sMDXBacklog value to csADOMD Source.

    Below is the string value stored in sMDXBacklog

    MDX Query


    Thanks & Regards, Santhosh

    2012년 3월 7일 수요일 오전 9:13