Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

Monday, March 26, 2012

How to get the numbers of row in a table using function. Simple but there is a problem i have

Here is the code. Trying to get the number of the rows in a table. If it is greater than 0 return false else return true. Later i changed this code with if else but i am wondering why it is giving this error?

Code Snippet

CREATE FUNCTION [dbo].[Ready]

(

-- Add the parameters for the function here

@.ProductPrm uniqueidentifier

)

RETURNS bit

AS

BEGIN

-- Declare the return variable here

DECLARE @.ProductNum int;

DECLARE @.Status bit;

-- Add the T-SQL statements to compute the return value here

SELECT @.ProductNum =COUNT(*)

FROM tblProduct

WHERE ProductID = @.ProductPrm

-- Return the result of the function

CASE WHEN @.ProductNum >= 1 THEN @.Status = 'False' ELSE @.Status = 'True' END

RETURN @.Status

END

Code Snippet

Msg 156, Level 15, State 1, Procedure RestoranHazirMi, Line 25

Incorrect syntax near the keyword 'CASE'.

Msg 102, Level 15, State 1, Procedure RestoranHazirMi, Line 29

Incorrect syntax near 'END'.

CASE WHEN is a statement level construction, not flow control

You could use

Code Snippet

CREATE FUNCTION [dbo].[Ready]

(

-- Add the parameters for the function here

@.ProductPrm uniqueidentifier

)

RETURNS bit

AS

BEGIN

-- Declare the return variable here

DECLARE @.ProductNum int;

DECLARE @.Status bit;

-- Add the T-SQL statements to compute the return value here

SELECT @.Status = CASE WHEN COUNT(*)>=1 THEN 'False' ELSE 'True' END

FROM tblProduct

WHERE ProductID = @.ProductPrm

RETURN @.Status

END

OR (IF/ELSE for flow control):

Code Snippet

CREATE FUNCTION [dbo].[Ready]

(

-- Add the parameters for the function here

@.ProductPrm uniqueidentifier

)

RETURNS bit

AS

BEGIN

-- Declare the return variable here

DECLARE @.ProductNum int;

DECLARE @.Status bit;

-- Add the T-SQL statements to compute the return value here

SELECT @.ProductNum =COUNT(*)

FROM tblProduct

WHERE ProductID = @.ProductPrm

-- Return the result of the function

IF (@.ProductNum >= 1)

SET @.Status = 'False'

ELSE

SET @.Status = 'True'

RETURN @.Status

END

|||thanks dude. I've learned it now.sql

Monday, March 12, 2012

How to get result of Expression which builds dynamically?

I am using SQL Server 2000 and in SP or Function, my problem is as follows:
I have one expression in variable of varchar. I want result of that
expression into another variable which is of numeric. For that code look
likes:
--code is as follows--
--Declaration of variables
declare @.str1 varchar (100)
declare @.int1 numeric (18, 2)
--This is assignment is for sampling purpose
select @.str1 = '2 + 2 * 8 / 3'
--Below sentence is my problem, I do not know the way of getting result of
expression in this situation
select @.int1 = cast(@.str1 as numeric)
--I need this value of variable for further use
select @.int1
--code ends here--
I will be thankful if problem get solved. Please note there are lots of code
before building expression and after getting result of this. I stuck up at
this point, as not able to convert string expression to numeric and hence
result.
Thank you in advance.Hi
You could do something like:
--code is as follows--
--Declaration of variables
DECLARE @.str1 varchar (100)
DECLARE @.int1 numeric (18, 2)
CREATE TABLE #tmp ( int1 numeric (18, 2) )
--This is assignment is for sampling purpose
SET @.str1 = 'SELECT (2 + (2 * 8)) / 3'
INSERT INTO #tmp ( int1 )
EXEC ( @.str1 )
SELECT @.int1 = int1 FROM #tmp
SELECT @.int1
DROP TABLE #tmp
But it would probably not be a very scallable solution.
John
"Kaushik Gadani" wrote:

> I am using SQL Server 2000 and in SP or Function, my problem is as follows
:
> I have one expression in variable of varchar. I want result of that
> expression into another variable which is of numeric. For that code look
> likes:
> --code is as follows--
> --Declaration of variables
> declare @.str1 varchar (100)
> declare @.int1 numeric (18, 2)
> --This is assignment is for sampling purpose
> select @.str1 = '2 + 2 * 8 / 3'
> --Below sentence is my problem, I do not know the way of getting result of
> expression in this situation
> select @.int1 = cast(@.str1 as numeric)
> --I need this value of variable for further use
> select @.int1
> --code ends here--
> I will be thankful if problem get solved. Please note there are lots of co
de
> before building expression and after getting result of this. I stuck up at
> this point, as not able to convert string expression to numeric and hence
> result.
> Thank you in advance.

How to get result of Expression which builds dynamically?

I am using SQL Server 2000 and in SP or Function, my problem is as follows:
I have one expression in variable of varchar. I want result of that
expression into another variable which is of numeric. For that code look
likes:
--code is as follows--
--Declaration of variables
declare @.str1 varchar (100)
declare @.int1 numeric (18, 2)
--This is assignment is for sampling purpose
select @.str1 = '2 + 2 * 8 / 3'
--Below sentence is my problem, I do not know the way of getting result of
expression in this situation
select @.int1 = cast(@.str1 as numeric)
--I need this value of variable for further use
select @.int1
--code ends here--
I will be thankful if problem get solved. Please note there are lots of code
before building expression and after getting result of this. I stuck up at
this point, as not able to convert string expression to numeric and hence
result.
Thank you in advance.Hi
You could do something like:
--code is as follows--
--Declaration of variables
DECLARE @.str1 varchar (100)
DECLARE @.int1 numeric (18, 2)
CREATE TABLE #tmp ( int1 numeric (18, 2) )
--This is assignment is for sampling purpose
SET @.str1 = 'SELECT (2 + (2 * 8)) / 3'
INSERT INTO #tmp ( int1 )
EXEC ( @.str1 )
SELECT @.int1 = int1 FROM #tmp
SELECT @.int1
DROP TABLE #tmp
But it would probably not be a very scallable solution.
John
"Kaushik Gadani" wrote:
> I am using SQL Server 2000 and in SP or Function, my problem is as follows:
> I have one expression in variable of varchar. I want result of that
> expression into another variable which is of numeric. For that code look
> likes:
> --code is as follows--
> --Declaration of variables
> declare @.str1 varchar (100)
> declare @.int1 numeric (18, 2)
> --This is assignment is for sampling purpose
> select @.str1 = '2 + 2 * 8 / 3'
> --Below sentence is my problem, I do not know the way of getting result of
> expression in this situation
> select @.int1 = cast(@.str1 as numeric)
> --I need this value of variable for further use
> select @.int1
> --code ends here--
> I will be thankful if problem get solved. Please note there are lots of code
> before building expression and after getting result of this. I stuck up at
> this point, as not able to convert string expression to numeric and hence
> result.
> Thank you in advance.

Friday, March 9, 2012

How to get permissions on a SQL databse table for a user group defined in AD

Hi, i am trying to find permissions on SQL server database tables for a usergroup defined in Active Directory.

there is one function in SQL : “SELECT * FROM fn_my_permissions('TableName', 'OBJECT')”

This function get me the permission on TableName table for the current user. but i want that inforamtion for a user group defined in AD.

Is tehre any way to acheive that?

-Mani

The best (and probably only) way is to login as a member of the AD Group and run the query on sys.fn_my_permissions.

HTH,

-Steven Gott

SDE/T

SQL Server

How to get permissions on a SQL databse table for a user group defined in AD

Hi, i am trying to find permissions on SQL server database tables for a usergroup defined in Active Directory.

there is one function in SQL :“SELECT*FROM fn_my_permissions('TableName','OBJECT')”

This function get me the permission on TableName table for the current user. but i want that inforamtion for a user group defined in AD.

Is tehre any way to acheive that?

-Mani

The best (and probably only) way is to login as a member of the AD Group and run the query on sys.fn_my_permissions.

HTH,

-Steven Gott

SDE/T

SQL Server

Wednesday, March 7, 2012

how to get only weekdays

Using SS2000, in QA I want to return data for only days Monday thru Friday.
Is there a way to do this? Is there some function that will give me only the
weekdays?
Thanks,
Dan D.
Dan,
Check http://www.aspfaq.com/show.asp?id=2519.
Dejan Sarka, SQL Server MVP
Mentor
www.SolidQualityLearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> Using SS2000, in QA I want to return data for only days Monday thru
> Friday.
> Is there a way to do this? Is there some function that will give me only
> the
> weekdays?
> Thanks,
> --
> Dan D.
|||Thanks Dejan. I'll take a look at that.
Dan D.
"Dejan Sarka" wrote:

> Dan,
> Check http://www.aspfaq.com/show.asp?id=2519.
> --
> Dejan Sarka, SQL Server MVP
> Mentor
> www.SolidQualityLearning.com
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
>
>
|||You could use the DAY function to extract the numeric day of the week
select DAY(getdate())
This would give you all Sundays, for example.
SELECT * FROM Table1 where DAY(YourDateField) = 1
If you need to account for holidays or other more complex date calculations
the calendar table is the way to go.
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> Using SS2000, in QA I want to return data for only days Monday thru
Friday.
> Is there a way to do this? Is there some function that will give me only
the
> weekdays?
> Thanks,
> --
> Dan D.
|||SELECT * FROM Table1 where DATEPART(dw, YourDateField) between 2 and 6
http://sqlservercode.blogspot.com/
|||I discovered that function. I also discovered datepart which is what I'm
using. Thanks Terri.
Dan D.
"Terri" wrote:

> You could use the DAY function to extract the numeric day of the week
> select DAY(getdate())
> This would give you all Sundays, for example.
> SELECT * FROM Table1 where DAY(YourDateField) = 1
> If you need to account for holidays or other more complex date calculations
> the calendar table is the way to go.
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> Friday.
> the
>
>
|||I came across datepart after some more looking. It works. Thanks SQL.
Dan D.
"SQL" wrote:

> SELECT * FROM Table1 where DATEPART(dw, YourDateField) between 2 and 6
> http://sqlservercode.blogspot.com/
>

how to get only weekdays

Using SS2000, in QA I want to return data for only days Monday thru Friday.
Is there a way to do this? Is there some function that will give me only the
weekdays?
Thanks,
--
Dan D.Dan,
Check http://www.aspfaq.com/show.asp?id=2519.
Dejan Sarka, SQL Server MVP
Mentor
www.SolidQualityLearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> Using SS2000, in QA I want to return data for only days Monday thru
> Friday.
> Is there a way to do this? Is there some function that will give me only
> the
> weekdays?
> Thanks,
> --
> Dan D.|||Thanks Dejan. I'll take a look at that.
--
Dan D.
"Dejan Sarka" wrote:

> Dan,
> Check http://www.aspfaq.com/show.asp?id=2519.
> --
> Dejan Sarka, SQL Server MVP
> Mentor
> www.SolidQualityLearning.com
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
>
>|||You could use the DAY function to extract the numeric day of the week
select DAY(getdate())
This would give you all Sundays, for example.
SELECT * FROM Table1 where DAY(YourDateField) = 1
If you need to account for holidays or other more complex date calculations
the calendar table is the way to go.
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> Using SS2000, in QA I want to return data for only days Monday thru
Friday.
> Is there a way to do this? Is there some function that will give me only
the
> weekdays?
> Thanks,
> --
> Dan D.|||SELECT * FROM Table1 where DATEPART(dw, YourDateField) between 2 and 6
http://sqlservercode.blogspot.com/|||I discovered that function. I also discovered datepart which is what I'm
using. Thanks Terri.
--
Dan D.
"Terri" wrote:

> You could use the DAY function to extract the numeric day of the week
> select DAY(getdate())
> This would give you all Sundays, for example.
> SELECT * FROM Table1 where DAY(YourDateField) = 1
> If you need to account for holidays or other more complex date calculation
s
> the calendar table is the way to go.
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> Friday.
> the
>
>|||I came across datepart after some more looking. It works. Thanks SQL.
--
Dan D.
"SQL" wrote:

> SELECT * FROM Table1 where DATEPART(dw, YourDateField) between 2 and 6
> http://sqlservercode.blogspot.com/
>

how to get only weekdays

Using SS2000, in QA I want to return data for only days Monday thru Friday.
Is there a way to do this? Is there some function that will give me only the
weekdays?
Thanks,
--
Dan D.Dan,
Check http://www.aspfaq.com/show.asp?id=2519.
--
Dejan Sarka, SQL Server MVP
Mentor
www.SolidQualityLearning.com
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> Using SS2000, in QA I want to return data for only days Monday thru
> Friday.
> Is there a way to do this? Is there some function that will give me only
> the
> weekdays?
> Thanks,
> --
> Dan D.|||Thanks Dejan. I'll take a look at that.
--
Dan D.
"Dejan Sarka" wrote:
> Dan,
> Check http://www.aspfaq.com/show.asp?id=2519.
> --
> Dejan Sarka, SQL Server MVP
> Mentor
> www.SolidQualityLearning.com
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> > Using SS2000, in QA I want to return data for only days Monday thru
> > Friday.
> > Is there a way to do this? Is there some function that will give me only
> > the
> > weekdays?
> >
> > Thanks,
> > --
> > Dan D.
>
>|||You could use the DAY function to extract the numeric day of the week
select DAY(getdate())
This would give you all Sundays, for example.
SELECT * FROM Table1 where DAY(YourDateField) = 1
If you need to account for holidays or other more complex date calculations
the calendar table is the way to go.
"Dan D." <DanD@.discussions.microsoft.com> wrote in message
news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> Using SS2000, in QA I want to return data for only days Monday thru
Friday.
> Is there a way to do this? Is there some function that will give me only
the
> weekdays?
> Thanks,
> --
> Dan D.|||SELECT * FROM Table1 where DATEPART(dw, YourDateField) between 2 and 6
http://sqlservercode.blogspot.com/|||I discovered that function. I also discovered datepart which is what I'm
using. Thanks Terri.
--
Dan D.
"Terri" wrote:
> You could use the DAY function to extract the numeric day of the week
> select DAY(getdate())
> This would give you all Sundays, for example.
> SELECT * FROM Table1 where DAY(YourDateField) = 1
> If you need to account for holidays or other more complex date calculations
> the calendar table is the way to go.
> "Dan D." <DanD@.discussions.microsoft.com> wrote in message
> news:B7E42041-0ADA-4AFA-8512-8EF4806E33DC@.microsoft.com...
> > Using SS2000, in QA I want to return data for only days Monday thru
> Friday.
> > Is there a way to do this? Is there some function that will give me only
> the
> > weekdays?
> >
> > Thanks,
> > --
> > Dan D.
>
>|||I came across datepart after some more looking. It works. Thanks SQL.
--
Dan D.
"SQL" wrote:
> SELECT * FROM Table1 where DATEPART(dw, YourDateField) between 2 and 6
> http://sqlservercode.blogspot.com/
>

Friday, February 24, 2012

How to get list of all Sql servers on network

Hi,
Is there any function/API in vb to retrieve all the sql servers that are avaiable on a network? Basically, i wanted to implement this facility in my application where users can select a server from list of all avaiable servers on LAN.

Thanks!
Asif.Net, Im having trouble with a couple of the TYPES that are used in the functions.

Have you got this figured out in .NET yet?

Please let me know if you have a resolution.

Thanks,
Malcolm Phillips
Malcolm.Phillps@.prgx.com|||If you get GFI lanscan you'll find there's a script there that enumerates SQL Servers on the network. Its basically VB script but I don;'t have it here at home.

To do it in asp.net I think you'd need to import the SQLDMO namespace|||How do I import the SQLDMO namespace? Please|||You add the Microsoft SQLDMO Object Library as a (COM) Reference to your project, then you add

<%@. Import Namespace="SQLDMO"%>
to your ASP.NET page.

Terri|||Take a look at http://www.extremeexperts.com/sql/faq/SQLDMO-ListServers.aspx for an example ... This works in VB also ...|||Dim mDMOApp As New SQLDMO.Application Dim mNames As SQLDMO.NameList Dim t As Integer mDMOApp = New SQLDMO.Application mNames = mDMOApp.ListAvailableSQLServers() lstServers.Items.Clear() For t = 1 To mNames.Count lstServers.Items.Add(mNames.Item(t)) Next

how to get last updated date

Hi,
I am looking for a function (or something else) that shows me, when a row in MS SQL Server was updated the last time. is it possible?
thanks
deviant69How about trying out DBCC SHOW_STATISTICS, check this link for more info:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_6jlf.asp|||thank you. i am going to try it.
deviant69

How to get Last record

Hi all
How to get last record
when i group with date i am getting number of records but in those records need to get last record
Is there any function like this
i am working with Crstal reports 8.5
Thanks a lotCreate a formula having this code

if NextIsNull({Field})=True then
{Field}|||Thanks

Sunday, February 19, 2012

how to get fiels value in Code

Hello,
I wrote a function in vb.net and i Sent her parameter.
The function is used in a table cell.
I want the function to use a field value,
I tried :
Fileds!myFilesName.Value
But it didn't work.
Can I do this kind of thing?
Thanks.On Jul 1, 8:49 am, nicknack <roezo...@.gmail.com> wrote:
> Hello,
> I wrote a function in vb.net and i Sent her parameter.
> The function is used in a table cell.
> I want the function to use a field value,
> I tried :
> Fileds!myFilesName.Value
> But it didn't work.
> Can I do this kind of thing?
> Thanks.
I don't quite follow what you are requesting; however, to use a field
value from a report dataset, you would use an expression similar to
the following:
=Fields!FieldName.Value
If you are wanting to include custom code, you would utilize it in the
following way:
In the Layout view, select the Report drop-down menu. Select Report
Properties... Then select the Code tab and enter the code here.
Hopefully, this gives you a start.
Regards,
Enrique Martinez
Sr. Software Consultant|||Hi Martinez, Its look like I meet you on every question of mine (And I
am very glad for that :)
I'll will try to explain again:
I have a table in my report.
in one of the cells I have a filed. some thing like:
=Fields!FieldName.Value
Now, Let say I want to add him the value "2". I will use:
=Fields!FieldName.Value + 2
Now, let say that I want to call a function that will add him the
value "2" and return the result.
I can use the following call:
=Code.AddTwoFunction(Fields!FieldName.Value)
And in my code I will get the Filed value as parameter and add him the
2.
What I wanted to know is if I can call the function with out the
parameter and tell her to automaticlly get the value of the field from
the row she was called?
The reason I need this is that I have a function that need to get 5
fileds and when I call it it looks some thing like:
=Code.AddTwoFunction(Fields!FieldName.Value,Fields!
FieldName2.Value,Fields!FieldName3.Value,Fields!
FieldName4.Value,Fields!FieldName5.Value)
Hope I explain my self better.
Thanks again!
EMartinez :
> On Jul 1, 8:49 am, nicknack <roezo...@.gmail.com> wrote:
> > Hello,
> > I wrote a function in vb.net and i Sent her parameter.
> > The function is used in a table cell.
> > I want the function to use a field value,
> > I tried :
> > Fileds!myFilesName.Value
> >
> > But it didn't work.
> > Can I do this kind of thing?
> >
> > Thanks.
>
> I don't quite follow what you are requesting; however, to use a field
> value from a report dataset, you would use an expression similar to
> the following:
> =Fields!FieldName.Value
> If you are wanting to include custom code, you would utilize it in the
> following way:
> In the Layout view, select the Report drop-down menu. Select Report
> Properties... Then select the Code tab and enter the code here.
> Hopefully, this gives you a start.
> Regards,
> Enrique Martinez
> Sr. Software Consultant|||Hi,
On the similar lines, can I access other Report Items on the report namely
Line Object/Sub Report Object. I would like to read the Line Objects Vertical
position value or SubReports Height property.
Could you please help me on this.
Regards,
Sudhakara.T.P.
"nicknack" wrote:
> Hi Martinez, Its look like I meet you on every question of mine (And I
> am very glad for that :)
> I'll will try to explain again:
> I have a table in my report.
> in one of the cells I have a filed. some thing like:
> =Fields!FieldName.Value
> Now, Let say I want to add him the value "2". I will use:
> =Fields!FieldName.Value + 2
> Now, let say that I want to call a function that will add him the
> value "2" and return the result.
> I can use the following call:
> =Code.AddTwoFunction(Fields!FieldName.Value)
> And in my code I will get the Filed value as parameter and add him the
> 2.
> What I wanted to know is if I can call the function with out the
> parameter and tell her to automaticlly get the value of the field from
> the row she was called?
> The reason I need this is that I have a function that need to get 5
> fileds and when I call it it looks some thing like:
> =Code.AddTwoFunction(Fields!FieldName.Value,Fields!
> FieldName2.Value,Fields!FieldName3.Value,Fields!
> FieldName4.Value,Fields!FieldName5.Value)
> Hope I explain my self better.
> Thanks again!
> EMartinez :
> > On Jul 1, 8:49 am, nicknack <roezo...@.gmail.com> wrote:
> > > Hello,
> > > I wrote a function in vb.net and i Sent her parameter.
> > > The function is used in a table cell.
> > > I want the function to use a field value,
> > > I tried :
> > > Fileds!myFilesName.Value
> > >
> > > But it didn't work.
> > > Can I do this kind of thing?
> > >
> > > Thanks.
> >
> >
> > I don't quite follow what you are requesting; however, to use a field
> > value from a report dataset, you would use an expression similar to
> > the following:
> > =Fields!FieldName.Value
> > If you are wanting to include custom code, you would utilize it in the
> > following way:
> > In the Layout view, select the Report drop-down menu. Select Report
> > Properties... Then select the Code tab and enter the code here.
> > Hopefully, this gives you a start.
> >
> > Regards,
> >
> > Enrique Martinez
> > Sr. Software Consultant
>

How to get fields value in function

Hello,
I wrote a function in vb.net and i Sent her parameter.
The function is used in a table cell.
I want the function to use a field value,
I tried :
Fileds!myFilesName.Value

But it didn't work.
Can I do this kind of thing?

Thanks.

Instead of Fields!myFielsName.value it would be something like this for the expression:

=Code.YourFunctionName(Fields!myFieldName.Value)

Hoep this helps

|||Hi.
Thanks for the amswer.

I know how to call a function from my report with a value.

I'll will try to explain again:

I have a table in my report.

in one of the cells I have a filed. something like:

=Fields!FieldName.Value

Now, Let say I want to add him the value "2". I will use:

=Fields!FieldName.Value + 2

Now, let say that I want to call a function that will add him the
value "2" and return the result.

I can use the following call:

=Code.AddTwoFunction(Fields!FieldName.Value)

And in my code I will get the Filed value as parameter and add him the
2.

What I wanted to know is if I can call the function with out the
parameter and tell her to automaticlly get the value of the field from
the row she was called?

The reason I need this is that I have a function that need to get 5
fileds and when I call it it looks some thing like:

=Code.AddTwoFunction(Fields!FieldName.Value,Fields!
FieldName2.Value,Fields!FieldName3.Value,Fields!
FieldName4.Value,Fields!FieldName5.Value)

What I would like to do is to call the function from the cell like =Code.AddTwoFunc() and inside the function use something like:

dim str = Fields!FieldName.Value + 2;

The problem is that it doesn't recognize the"Fields!FieldName.Value"

Hope I explain my self better