Wednesday, March 7, 2012

Reporting Service 2000 Error: ...is not accessible in this context because it is Private.

I am coding for Reporting Services 2000 (the one under the code tab) and these following codes. It generated an error:...There is an error on line 31 of custom code: [BC30390] 'Microsoft.ReportingServices.ReportProcessing.ExprHostObjectModel.CustomCodeProxyBase.a' is not accessible in this context because it is 'Private'.

So.. I changed the declaration of the variables. From Dim, I changed it Public Dim but after changing, this error occurred:...There is an error on line 5 of custom code: [BC30247] 'Public' is not valid on a local variable declaration.

Please help.. Thanks! Here's my code..

Public Shared Function GetChargeWgt(housenoas string, chrgwtas Decimal)
Public Dim MyConnObjas ADODB.Connection
Public Dim myRecSetas ADODB.Recordset
Public Dim SQLas string
Public Dim cwas Decimal

MyConnObj.Open _
("Provider = sqloledb;" & _
"Data Source=<datasource here>;" & _
"Initial Catalog=<database name here>;" & _
"User ID=<uname>;" & _
"Password=<pword>;")

SQL = "SELECT a.house_no, "
SQL = SQL + "CASEWHEN a.book_type_id ='AE'OR a.book_type_id ='AI'THEN (SELECTCAST(a.charge_valueAS DECIMAL(10,2))) "
SQL = SQL + "WHEN a.book_type_id ='SE'OR a.book_type_id ='SI'THEN (SELECTCAST(a.gross_valueAS DECIMAL(10,2))) "
SQL = SQL + "END AS chargeweight "
SQL = SQL + "FROM OPR_BKPARMS_TR a "
SQL = SQL + "WHEREa.house_no ='" + houseno + "'"

myRecSet.Open(SQL, MyConnObj)
cw = myRecSet.Fields(a.house_no)

return cw
End Function

I saw one post which said that I should try using Protected.. I did followed it but it still had the same error..

>_<

|||

Hi,

So.. I changed the declaration of the variables. From Dim, I changed it Public Dim but after changing, this error occurred: ...There is an error on line 5 of custom code: [BC30247] 'Public' is not valid on a local variable declaration.

From your description, it seems that the system can't access the data table object a. Since you have declared the private connection and recordset. So please try to make sure if the data table is accessible first, also, try to declare your variable in your class level instead of in a shared method.

Thanks.

|||

Oh.. I'll try it out.. Thanks

No comments:

Post a Comment