Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have created a report in VS 2013 that gets user data from a table in sql using c#. I have connected to sql and have a dataset for the table.

I quickly created it by saying I wanted a report based upon a sql table.

I have a report that displays the data, however now I want to add the user name. The user name is not stored on the table but can be derived from a dll call or from the following VB code...

VB.NET
Public Function getname(lanid As String) As String
    Dim app As Microsoft.Office.Interop.Outlook.Application
    Dim appNameSpace As Microsoft.Office.Interop.Outlook._NameSpace

    Dim recip As Microsoft.Office.Interop.Outlook.Recipient
    Dim ae As Microsoft.Office.Interop.Outlook.AddressEntry

    app = New Microsoft.Office.Interop.Outlook.Application
    appNameSpace = app.GetNamespace("MAPI")
    recip = appNameSpace.CreateRecipient(lanid)
    recip.Resolve()
    Try
        ae = recip.AddressEntry
    Catch ex As Exception
        getname = "Not found"
        Exit Function
    End Try

    Dim name As String
    name = ae.Name
    getname = name
End Function


I have tried the following but I just get an #error in the column...

1, Added references to the MS DLLs required for above
2, Added this code to custom code section
3, Added a column and set the expression to
=Code.getname("F468s8")

What is wrong? What is the correct way to derive data from a method call or is this too complicated for a report?

It looks like the dataset is based off the table so I cannot add a column to that with a view to filling in the data before I display the report?

I guess the overall question for you report experts is, how would you code this. All I need is a simple example of how to call an inline method/dll OR do I need to create a new dataset and manually populate that first?

I am new to reporting (in case you had not realized)!!!

Thanks in advance
John
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900