Thursday, March 8, 2012

Database access in custom code

Hi, I'm trying to access a db from the custom code, but it doesn't seem
to be possible, because if i try to preview the report i get errors:
[BC30002] 'DAO.Recordset' type not defined, and some other similar
errors if i try to use SqlConnection ect.
Is it a strange behavior of my reporting services installation?
If not how can I access db from my custom code?I can do it fine so it must be something in your code.
A tip would be to try the customer code out by writing a simple windows
application that uses the code. If this works then the report server should
also work (unless you have security problems).
If you are writing the code in the Code properties of the report then be
sure to add the appropriate references in the references tab.
Craig
"Tur" <cenci.cristiano@.gmail.com> wrote in message
news:1141376485.288962.263920@.v46g2000cwv.googlegroups.com...
> Hi, I'm trying to access a db from the custom code, but it doesn't seem
> to be possible, because if i try to preview the report i get errors:
> [BC30002] 'DAO.Recordset' type not defined, and some other similar
> errors if i try to use SqlConnection ect.
> Is it a strange behavior of my reporting services installation?
> If not how can I access db from my custom code?
>|||Hi Craig, thank you so much for your answer!
I'm writing my custom code in the Code properties of the report, as you
say,
but I'm not sure how to add the appropriate references in reference
tab.
An example:
function MyFun(myStr as String) as String
Dim temp as DAO.Recordset
return "Nothing"
end function
raises an error: "d:\myPath\myRDL.rdl : [BC30002] 'DAO.Recordset' type
not defined."
I'm not sure of what is the problem...|||Hi Craig, thank you so much for your answer!
I'm writing my custom code in the Code properties of the report, as you
say,
but I'm not sure how to add the appropriate references in reference
tab.
An example:
function MyFun(myStr as String) as String
Dim temp as DAO.Recordset
return "Nothing"
end function
raises an error: "d:\myPath\myRDL.rdl : [BC30002] 'DAO.Recordset' type
not defined."
I'm not sure of what is the problem...|||Hi Craig, thank you so much for your answer!
I'm writing my custom code in the Code properties of the report, as you
say,
but I'm not sure how to add the appropriate references in reference
tab.
An example:
function MyFun(myStr as String) as String
Dim temp as DAO.Recordset
return "Nothing"
end function
raises an error: "d:\myPath\myRDL.rdl : [BC30002] 'DAO.Recordset' type
not defined."
I'm not sure of what is the problem...|||Firstly I urge you to try out your custom code from outside of Reporting
Services. This will give you 100 times better error messages plus you will
be able to debug your code which you can't do if you are writing the code in
the reports code.
After you have completed this and its all working fine then, and only then,
copy the code from the function in to the Code properties of the report.
Now the error you are currently getting is to do with a reference that the
report server is not aware of. To add this reference go to the
Report>Report Properties...>References and click on the "..." to add a new
reference.
Choose the DLL that contains the namespace for the DAO.Recordset and add it
to your report.
Craig
"Tur" <cenci.cristiano@.gmail.com> wrote in message
news:1141722816.893159.67500@.j33g2000cwa.googlegroups.com...
> Hi Craig, thank you so much for your answer!
> I'm writing my custom code in the Code properties of the report, as you
> say,
> but I'm not sure how to add the appropriate references in reference
> tab.
>
> An example:
> function MyFun(myStr as String) as String
> Dim temp as DAO.Recordset
> return "Nothing"
> end function
>
> raises an error: "d:\myPath\myRDL.rdl : [BC30002] 'DAO.Recordset' type
> not defined."
>
> I'm not sure of what is the problem...
>

No comments:

Post a Comment