Showing posts with label parameter. Show all posts
Showing posts with label parameter. Show all posts

Friday, March 30, 2012

How to get type of parameter passed in stored procedure?

Hi ,

I wrote a stored procedure with one uinqueidentifier parameter.Depending upon the value passed during execution type of parameter passed is changing.

Example:

CREATE PROCEDURE ABC_Proc

@.ABC uniqueidentifier = NULL

Execution:

EXEc ABC_Proc ' '

If I pass the uiqueidentifier from the same table then the program executes properly.If same uinqueidentifier from other table or NULL or '' is passed the following error is displayed

"conversion failed when converting from a character string to unique identifier."

Questions:IS there a way to get the datatype of parameter passed in the querry?so, that I can modify accordingly.

Thanks,

Kodela.

Hi Kodela,

The easiest way is to use the new sql_variant datatype as the parameter, and then within the procedure, you can test for the base datatype and execute the appropriate action:

declare @.v sql_variant

set @.v = 123

if SQL_VARIANT_PROPERTY ( @.v , 'BaseType' ) = 'int'
begin
print 'int type passed'
end
else if SQL_VARIANT_PROPERTY ( @.v ,'BaseType' ) = 'uniqueidentifier'
begin
print 'uid type passed'
end

Cheers,
Rob

|||

You could use sql_variant, but the best thing to do is to treat parameters as strongly typed and only pass proper values to that parameter. You can get the type of the parameter from the information_schema:

CREATE PROCEDURE ABC_Proc
@.ABC uniqueidentifier = NULL
as
select @.ABC
go

select parameter_name, data_type
from information_schema.parameters
where specific_name = 'ABC_Proc'
and specific_schema = 'dbo'

|||

Robert Varga wrote:

use the new sql_variant datatype

Robert,

There is a reason that the variant datatype has been removed from Visual Studio.Net -it opens the code to potential attack vectors. Similarly, it is not a particularly good thing to use in SQL Server. Often the use of variants demonstrates a poor design, or just plain sloppy coding. -NOT drawing aspersions to you or your techniques, just commenting...

Regards,

|||

Hi Arnie,

I have to say I disagree completely. The SQL_VARIANT datatype was introduced in SQL 2005 for good reason. Just as there are valid reasons for using cursors, there are valid reasons for using the sql_variant datatype, and blanket statements alluding to their use constituting "poor design" are flawed.

In reality, we've been using varchar's as "variant" datatypes for years - ( CONVERT(varchar(15), GETDATE(), 103) anyone? ) and the new datatype removes precision related errors.

Cheeers,
Rob

|||

I actually have to agree that the SQL_VARIANT datatype should generally be avoided (as should converting dates to varchar values too, since that is usually a formatting gimmick that we *should* let the presentation layer handle :) for the same reason that VB programmers shouldn't generally use Option Strict (I think that was (is?) the syntax).

Especially in this situation, picking the proper datatype is part of the contract between caller and callee. In your example, it would not be possible to tell a GUID from a character value, certainly not when being passed in as a parameter, since it would be passed as a string of characters (or as a binary value) which could not be distinguished in code.

It is not completely useless when used for sparse property tables where you define the metadata of the column at runtime is a pretty good use, but generally having a column of unknown type means more code, more work, and greater chance for errors later.

|||

Hi Louis,

Sure; just as liberal use of, say, cursors is not a good thing, neither is the use of generic datatypes. My point is that there are circumstances in which the use of sql_variant (or cursors) are valid and should not be discounted by zealots simply because some Wrox book said they were "bad".

Cheers,
Rob

|||

Louis,

You demonstrate my point precisely. There is no need to use a sql_variant in this situation. The metadata is available. Strongly typed variables/parameters reduce coding and coding errors.

Using an object datatype (the .NET replacement for 'variant' has it's place and needs, and slq_variant has it's places and usages. However, in my opinion, it should not be used in a situation where the exact need does not exist. This is not one of those situations.

And gosh, if one wanted to morph a varchar() parameter, the datatype could be just another input parameter. For me, strongly typing is the key. If the dataype is known when the call is made, it should be strongly typed.

How to get the value of a parameter programmatically

Hi,,
Say I have connected to the webs ervice and extracted all the parameters of
a particular report ,,how can I show the default bvalue of those parameter
if any'
thanks for your help,,here is my code:
ReportingService rs = new ReportingService(enviromental_Vars.LocalPath);
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
//string report = this.cmbReports.Items[this.cmbReports.SelectedIndex].ToString();
bool forRendering = false;
string historyID = null;
ParameterValue[] values = null;
DataSourceCredentials[] credentials = null;
ReportParameter[] parameters = null;
try
{
parameters = rs.GetReportParameters(enviromental_Vars.ReportName, historyID,
forRendering, values, credentials);
if (parameters != null)
{
}
}There is a property on the ReportParameter class with the name of
DefaultValues, and of type string[].
You could use something along the lines of:
foreach(ReportParameter p in parameters)
{
string[] defaults = p.DefaultValues;
// work on defaults...
}
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Fri, 12 Nov 2004 19:12:19 -0800, "ALI-R" <newbie@.microsoft.com>
wrote:
>Hi,,
>Say I have connected to the webs ervice and extracted all the parameters of
>a particular report ,,how can I show the default bvalue of those parameter
>if any'
>thanks for your help,,here is my code:
>ReportingService rs = new ReportingService(enviromental_Vars.LocalPath);
>rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
>//string report =>this.cmbReports.Items[this.cmbReports.SelectedIndex].ToString();
>bool forRendering = false;
>string historyID = null;
>ParameterValue[] values = null;
>DataSourceCredentials[] credentials = null;
>ReportParameter[] parameters = null;
>try
>{
>parameters = rs.GetReportParameters(enviromental_Vars.ReportName, historyID,
>forRendering, values, credentials);
>if (parameters != null)
>{
>
>}
>}
>

Monday, March 26, 2012

How to get the parameter type in VB.net?

I am currently using the following embedded code to get the selected values from a Parameter and display in a textbox. I however have a number of reports and I don't want to include this in all of them. I have created a dll with some other functions but when i try to include the following function it throws an error on the Parameter type. What am I doing wrong, I am not all that familiar with dot net?


Public Function ShowParameterValues(ByVal parameter as Parameter) as String
Dim s as String

If parameter.count <= 5 then
If parameter.IsMultiValue and parameter.count > 1 then
s = " "
For i as integer = 0 to parameter.Count-1
if i = parameter.count - 1
s = s + CStr(parameter.Label(i))
else
s = s + CStr(parameter.Label(i)) + ", "
end if

Next
Else
s = " " + CStr(parameter.Label(0))
End If
else
s = " Only a maximum of 5 selection values can be displayed. "
End if
Return s
End Function

What's the error message?|||I am sorry..it says the type Parameter is not defined.|||

A multi-valued parameter is a 0-based array of objects, I'm pretty sure. But you should be passing the *name* of the parameter you want to reference, as a string, not the object. No?

Then you can say Parameters(tsParamName).Label(i) and Parameters(tsParamName).Count in your code...

HTH,

>L<

|||

It simply means it cannot find the type Parameter, either you need to reference the dll that contains the definition of the type Parameter or make to sure to include the CS file where that type Parameter is defined.

In your code,you are passing parameter as Parameter in the signature of the function, this is where it's complaining, it cannot find the Assembly where the type Parameter is defined.

|||

>>either you need to reference the dll that contains the definition of the type Parameter or make to sure to include the CS file where that type Parameter is defined.

Jonel, I honestly don't think that's correct... rather than including the reference to Parameter, I think the actual type he would need is ReportParameter here ... but in this case he could actually be passing the name of the parameter from the textbox expression (or wherever he's using the function), as I said...

>L<

|||

Hi, Lisa,

From within a custom assembly, you need to provide a fully qualified reference for the parameters type:

Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Parameters

If you use this reference, then when you install new releases of Reporting Services, you may need to recompile and redeploy the custom assembly.

|||

My apologies, Mary, Jonel, and everybody reading -- I misread the original post (saw the "embedded code" part but not that the poster was moving the code into a DLL!). Had a braino...

>L<

|||Thanks guys for your responses. After searching the net last week I found the answer. Thanks much for all your help.

How to get the output parameter from an internally called stored procedure??

Hi all,
i have a problem and couldnt find anything even close to it. please help me, here is the description of what i m trying to accomplish:
I have a trigger that is generating a column value and calling a stored procedure after the value is generated. And this stored procedure is setting this generated value as an output parameter. But my problem is:
my asp.net page is only sending an insert parameter to the table with the trigger, trigger is running some code depending on the insert parameter and calling this other stored procedure internally. So basically i m not calling this last stored procedure that sets the output parameter within my web form. How can i get the output parameter in my webform? Everthing is working now, whenever an insert hits the table trigger runs and generates this value and called stored procedure sets it as an output parameter. I can get the output parameter with no problem in query analyzer, so the logic has no problem but i have no idea how this generated output parameter can be passed in my webform since its not initiated there.
any help will greately be appreciated, i m sure asp.net and sql server 2000 is powerful and flexible enough to accomplish this but how??
-shane

Try these links the last link is a tool that will generate the code for you but read the articles first so you know what you are doing. Hope this helps.
http://msdn.microsoft.com/msdnmag/issues/05/05/DataPoints/default.aspx

http://www.codeguru.com/vb/gen/vb_database/sqlserver/article.php/c8671__3/

http://www.adonetexpress.com/default.aspx

|||thanks for the links, there are great information there but my problemis not with calling stored procedures within a page or creating astored procedure. my problem is getting the output parameter of astored procedure that is called within a trigger. From my understandingthis is not possible but i wanted to ask and make sure anyway.
thank you,
-shane

|||Can you post a sample code to demonstrate the issue? No need to post it all, if it is huge but something that would ease up reproing it.|||Hi,
i dont have the full code here but its something similat to below (ignore syntax)
my trigger:
instead of insert
as
declare @.ID int
select @.ID = select ID from inserted
begin
update mytable(mycolumn) --if the inserted parameter(@.ID) exists mycolumn will be updated
select mycolumn=mycolumn + 1
where mytable.myid in (select ID from inserted)
insert into mytable(mycolumn) -- if the inserted parameter doesnt exists it will be inserted with a mycolumn=0
values(0)
where mytable.myid not in (select ID from inserted)
end
myprocedure(@.ID)
go
the above trigger inserts a new row with mycolumn=0 to mytable if theinput parameter doesnt exists in mytable, if it exists instead of aninsert an update fires and the value of mycolumn increments one. Afterinsert/update finished i m calling myprocedure which will set the newvalue of mycolumn as an output parameter.
myprocedure
(@.ID int,
@.mycolumn int output)
select @.mycolumn=mycolumn from mytable
where ID = @.ID
please ignore the syntax mistakes, the actual code is working with no problem.
What i m trying to do is run an insert procedure or sql query with aparameter(@.ID) and get the output parameter which is @.mycolumn. Butthis mycolumn will be set to its final value after the trigger runs.
Is it possible?
thanks,
-shane
|||I am assuming this is what you need, try this link for the code to an undocumented stored proc calledsp_executesql. Hope this helps.
http://support.microsoft.com/default.aspx?scid=kb;en-us;262499|||It looks like something i might need, i will test it asap.
Any idea how to get the output parameter created/kept by sp_execuresql into my asp.net page?
my understanding is sp_executesql will call my stored procedure andkeep its output parameter as an output parameter but i still dont knowhow to use this parameter in my page.
thank you,
-shane
|||Run a search for "Using sp_executesql" in the BOL (books online) it shows some examples of what you can do but there is no ADO.NET code. Hope this helps.|||thank you,
thats what i ll do. thanks again for the link
-shane
sql

Monday, March 19, 2012

How to get status of sp_executesql

Hello

The basic requirement is to import data from excel sheet and save it to a table. The excel filename and sheet name is passed in as a parameter to a stored procedure. I am using sp_executesql to execute the statement.

First I delete all the records from the table and then copy the data from excel into the table. I want to do this as a transaction so that if there is any error in the import process, I want to rollback the transaction otherwise commit it. sp_executesql returns 0 for success or 1 for failure.

In my case, even if there is any syntax error, I get the status of 0. Also the @.@.ROWCOUNT contains some positive number greater than 0 even if some error occurs.

BEGIN TRANSACTION T1

GO

DELETE FROM SORTGROUP

GO

DECLARE @.Statement as NVARCHAR(1024)

DECLARE @.TableName as VARCHAR(32)

DECLARE @.ExcelFile AS VARCHAR(512)

DECLARE @.ParamNameList as VARCHAR(1024)

DECLARE @.SheetName as VARCHAR(64)

DECLARE @.Status as INT

DECLARE @.ErrorCode as INT

DECLARE @.RowCount AS INT

SET @.TableName = 'SORTGROUP'

SET @.ExcelFile = 'E:\PROJECTS\RALEIGH\TEST.XLS'

SET @.ParamNameList = '*'

SET @.SheetName = 'SORTGROUPDATA'

EXEC master..xp_sprintf @.Statement OUTPUT, 'INSERT %s SELECT %s FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 5.0;DATABASE=%s'', ''SELECT %s FROM [%s$]'')', @.TableName, @.ParamNameList, @.ExcelFile, @.ParamNameList, @.SheetName

SET @.Status = -1

exec @.Status=sp_executesql @.Statement

SELECT @.ErrorCode = @.@.ERROR, @.RowCount = @.@.ROWCOUNT

IF @.Status = -1

ROLLBACK TRANSACTION T1

ELSE COMMIT TRANSACTION T1

PRINT @.ErrorCode

PRINT @.RowCount

PRINT @.Status

Is there any reason why you're NOT using DTS to do this? The work flow management will handle all of that for you

Friday, March 9, 2012

How to get parameters in XSLT from template files...

I'd like to get the HTTP parameters to a form in both the XML template and
the XSLT.
I know that I can use <sql:param> to get the parameter for use in my SQL.
But why doesn't it also get passed to the XSLT as <xsl:param> values for me
to use?
PerWe cannot pass the variables to the stylesheet that way unfortunately. The
best way is to add them to the XML document that you pass to the stylesheet
and then take them and use them throughout your XSLT.
Best regards
Michael
"Per" <anonymous@.discussions.microsoft.com> wrote in message
news:uc4rlHEJFHA.904@.tk2msftngp13.phx.gbl...
> I'd like to get the HTTP parameters to a form in both the XML template and
> the XSLT.
> I know that I can use <sql:param> to get the parameter for use in my SQL.
> But why doesn't it also get passed to the XSLT as <xsl:param> values for
> me to use?
> Per
>

How to get parameters in XSLT from template files...

I'd like to get the HTTP parameters to a form in both the XML template and
the XSLT.
I know that I can use <sql:param> to get the parameter for use in my SQL.
But why doesn't it also get passed to the XSLT as <xsl:param> values for me
to use?
Per
We cannot pass the variables to the stylesheet that way unfortunately. The
best way is to add them to the XML document that you pass to the stylesheet
and then take them and use them throughout your XSLT.
Best regards
Michael
"Per" <anonymous@.discussions.microsoft.com> wrote in message
news:uc4rlHEJFHA.904@.tk2msftngp13.phx.gbl...
> I'd like to get the HTTP parameters to a form in both the XML template and
> the XSLT.
> I know that I can use <sql:param> to get the parameter for use in my SQL.
> But why doesn't it also get passed to the XSLT as <xsl:param> values for
> me to use?
> Per
>

How to get parameter passed to SQL query from access

I am new to sql and very familiar with access. I am using a very
large database(130M records) in ms sql2000 and think I need to front
end it with access for reports and forms, etc..

I have some questions:
1) Is there a way in SQL to prompt a user for input at the running of
a query like the [what is your name] construct in an access query?

2) I can't seem to create calculated fields in a view in sql. In
access I put "total:=hours*rate" and a new column would be created
which would contain the total.

3) I normally would create a form in access from which the access
queries would pull their variables and then insert those variables in
the queries or reports, etc. How would this be accomplished using
sql.

4) Lastly and probably most basic. How does a "real" sql developer
create reports and forms to interact with the enduser? I am using
access as a front end, but am open to suggestions.

Thanks,
Brad1. No - MSSQL is a pure server, and it has no concept of prompts, GUIs,
forms or other client-side interfaces. So you need to provide your own
front end, in Access, ASP, .NET or whatever other toolset you prefer.

2. Like this:

create view dbo.MyView
as
select hours, rate, hours * rate as 'total'
from dbo.MyTable

3. As above, you have to provide your own front end, so you would get
the values in the front end, and pass them to the back end. The best
way is usually to encapsulate your SQL code in stored procedures, and
pass the values as parameters to the procedure.

4. It probably depends on the application domain, the tools and
processes you already have etc. If your main requirement is reporting,
you might want to consider using a reporting tool, rather than building
your own functionality. SQL Server Reporting Services are free if you
have an MSSQL licence. But using Access as a front end certainly seems
to be a fairly common solution.

Simon

Wednesday, March 7, 2012

How to get non-fixed-width results in xp_sendmail?

(SQL Server 2000, SP3a)
Hello, all!
I'm using xp_sendmail with the @.query parameter and a @.separator of ', ' with an
attachment.
The query works out great -- but all of my string data is "fixed width", with spaces at
the end of them when I look at it in Excel. (Like it was CHAR(X) instead of VARCHAR(X).)
I've verified that the table is what I think it is (using VARCHARs). I think this is just
a function of xp_sendmail and an attachment. Is there any way to get rid of this
fixed-width artifact?
Thanks!
John PetersonThere's an alternative to SQLMail you might like to consider :-
http://www.sqldev.net/xp/xpsmtp.htm
--
HTH
Ryan Waight, MCDBA, MCSE
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:es$hDVhrDHA.360@.TK2MSFTNGP12.phx.gbl...
> (SQL Server 2000, SP3a)
> Hello, all!
> I'm using xp_sendmail with the @.query parameter and a @.separator of ', '
with an
> attachment.
> The query works out great -- but all of my string data is "fixed width",
with spaces at
> the end of them when I look at it in Excel. (Like it was CHAR(X) instead
of VARCHAR(X).)
> I've verified that the table is what I think it is (using VARCHARs). I
think this is just
> a function of xp_sendmail and an attachment. Is there any way to get rid
of this
> fixed-width artifact?
> Thanks!
> John Peterson
>|||Thanks, Ryan!
But, this alternative doesn't yet support the @.query type of operation, which I'm
currently relying on.
It seems to me that there ought to be *some* way to prevent the output from being in
fixed-width mode -- but for the life of me I cannot figure it out...
"Ryan Waight" <Ryan_Waight@.nospam.hotmail.com> wrote in message
news:O$Z7XOorDHA.1184@.TK2MSFTNGP10.phx.gbl...
> There's an alternative to SQLMail you might like to consider :-
> http://www.sqldev.net/xp/xpsmtp.htm
> --
> HTH
> Ryan Waight, MCDBA, MCSE
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:es$hDVhrDHA.360@.TK2MSFTNGP12.phx.gbl...
> > (SQL Server 2000, SP3a)
> >
> > Hello, all!
> >
> > I'm using xp_sendmail with the @.query parameter and a @.separator of ', '
> with an
> > attachment.
> >
> > The query works out great -- but all of my string data is "fixed width",
> with spaces at
> > the end of them when I look at it in Excel. (Like it was CHAR(X) instead
> of VARCHAR(X).)
> >
> > I've verified that the table is what I think it is (using VARCHARs). I
> think this is just
> > a function of xp_sendmail and an attachment. Is there any way to get rid
> of this
> > fixed-width artifact?
> >
> > Thanks!
> >
> > John Peterson
> >
> >
>

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

how to get driopdown for year

how can i display the dropdown for year values in sql reporting

i want to accept the value for year as parameter & also want user to select the value from dropdown that will display only the year values.

What product are you using?

Can you give more details about your situation.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.