Showing posts with label integer. Show all posts
Showing posts with label integer. Show all posts

Monday, March 26, 2012

Passing Integer list to SQL using TableAdapter?

I want to select rows that have an integer value IN a parameter list value

I want to pass an integer list to my tableadapter's select

as in Select * from sometable

Where myIntValue IN (@.intParamList )

I cannot figure out how to get my list into @.intParamList

It works fine as a single value - eg 3, but how do I set it to 1,2,3 ?

Thanks

Bill

Hi,

I don't think you can't pass 1,2,3 as integer parameter according to my knowledge. Well you might have to change the parameter to varchar and it will work for you.

Thanks and best regards,

|||

Thanks I got it.

The answer is to use a varchar list AND a Numbers table which allows me to Select the values without using IN

Googling SQL Numbers table gives several examples

Bill

Friday, March 9, 2012

Passing "null" in the URL for an Integer parameter.

Hello,
I've got a stored procedure that my report uses as a datasource. One of the parameters for the stored procedure is an Integer called "OfficeTypes". The stored procedure checks if OfficeTypes is null, and if it is it returns every record. I want to hide the "OfficeTypes" input on the report and pass a null value on the URL, however I can't seem to do this. My url is as follows:
"http://...&OfficeType:isnull=true"
I get the error message: "An attempt was made to set a report parameter 'OfficeTypeID-NULL' that is not defined in this report".
If I change my URL to the following:
"http://...&OfficeType=null"
I get the error message:"The value provided for the report parameter 'OfficeTypeID' is not valid for its type."
So the question is, how can you set an Integer parameter for a report to null using the URL? All help is welcome. Thanks.
--
Posted using Wimdows.net NntpNews Component -
Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.Hey Guys,
Could you please tell me how to use a stored procedure as the data source.
The problem that I am facing is, the fields returned by the stored procedure
are not getting listed in the fields window. I tried creating the fields
explicitly but it gave me an error that the required fields are not found in
the dataset.
Any pointers would be of lot of help.
thanks,
Nilesh
"SqlJunkies User" <User@.-NOSPAM-SqlJunkies.com> wrote in message
news:%23E1a0t2YEHA.2432@.tk2msftngp13.phx.gbl...
> Hello,
> I've got a stored procedure that my report uses as a datasource. One of
the parameters for the stored procedure is an Integer called "OfficeTypes".
The stored procedure checks if OfficeTypes is null, and if it is it returns
every record. I want to hide the "OfficeTypes" input on the report and pass
a null value on the URL, however I can't seem to do this. My url is as
follows:
> "http://...&OfficeType:isnull=true"
> I get the error message: "An attempt was made to set a report parameter
'OfficeTypeID-NULL' that is not defined in this report".
> If I change my URL to the following:
> "http://...&OfficeType=null"
> I get the error message:"The value provided for the report parameter
'OfficeTypeID' is not valid for its type."
> So the question is, how can you set an Integer parameter for a report to
null using the URL? All help is welcome. Thanks.
> --
> Posted using Wimdows.net NntpNews Component -
> Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine
supports Post Alerts, Ratings, and Searching.|||I'm not very experienced so I'm not sure I'll be much help, but first off in
the "Data" tab of your report, are you setting the command type to "Stored
Procedure" or are you setting it "Text" and calling the EXEC storedProcedure
command? If the command type is stored procedure, I'm not sure what to tell
you. Whenever I add a stored procedure this way the fields for the sp
automatically are added to the parameters list for my report, and thus show
up on the reports window. You could always add some parameters to the
reports parameter list and then edit the data set "Parameters" properties to
point to the properties you added. If you still have questions, explain more
about how and what you've done.
"Nilesh Oswal" <nilesh_oswal@.persistent.co.in> wrote in message
news:eaZ44D3YEHA.3536@.TK2MSFTNGP11.phx.gbl...
> Hey Guys,
> Could you please tell me how to use a stored procedure as the data
source.
> The problem that I am facing is, the fields returned by the stored
procedure
> are not getting listed in the fields window. I tried creating the fields
> explicitly but it gave me an error that the required fields are not found
in
> the dataset.
> Any pointers would be of lot of help.
> thanks,
> Nilesh
>
> "SqlJunkies User" <User@.-NOSPAM-SqlJunkies.com> wrote in message
> news:%23E1a0t2YEHA.2432@.tk2msftngp13.phx.gbl...
> > Hello,
> >
> > I've got a stored procedure that my report uses as a datasource. One of
> the parameters for the stored procedure is an Integer called
"OfficeTypes".
> The stored procedure checks if OfficeTypes is null, and if it is it
returns
> every record. I want to hide the "OfficeTypes" input on the report and
pass
> a null value on the URL, however I can't seem to do this. My url is as
> follows:
> > "http://...&OfficeType:isnull=true"
> > I get the error message: "An attempt was made to set a report parameter
> 'OfficeTypeID-NULL' that is not defined in this report".
> > If I change my URL to the following:
> > "http://...&OfficeType=null"
> > I get the error message:"The value provided for the report parameter
> 'OfficeTypeID' is not valid for its type."
> > So the question is, how can you set an Integer parameter for a report to
> null using the URL? All help is welcome. Thanks.
> >
> > --
> > Posted using Wimdows.net NntpNews Component -
> >
> > Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine
> supports Post Alerts, Ratings, and Searching.
>

Wednesday, March 7, 2012

pass string to stored procedure

I have a table that has the follow format
PageID (integer)
Member_Id (varchar(20))
in my VB.net application, i have two strings that that take the following
format
Pages="2,2,3,4,4"
Members= "member1,member2,member3,member4,member5"
is there any way to pass the string variables to a stored procedure and
perform some type of insert into statement?
i would want to do something like this in a stored procedure
insert into AccessTablePages (Member_Id,PageID)
values (@.Members, @.Pages)You should be able to adapt the methods in Erland Sommarskog's article here:
http://www.sommarskog.se/arrays-in-sql.html
Steve Kass
Drew University
"Fabuloussites" <Fabuloussites@.discussions.microsoft.com> wrote in message
news:8EB1C476-23D7-4D56-9480-E69431317A46@.microsoft.com...
>I have a table that has the follow format
> PageID (integer)
> Member_Id (varchar(20))
> in my VB.net application, i have two strings that that take the following
> format
> Pages="2,2,3,4,4"
> Members= "member1,member2,member3,member4,member5"
> is there any way to pass the string variables to a stored procedure and
> perform some type of insert into statement?
> i would want to do something like this in a stored procedure
>
> insert into AccessTablePages (Member_Id,PageID)
> values (@.Members, @.Pages)
>|||Looks promising.
thanks1
"Steve Kass" wrote:

> You should be able to adapt the methods in Erland Sommarskog's article her
e:
> http://www.sommarskog.se/arrays-in-sql.html
> Steve Kass
> Drew University
> "Fabuloussites" <Fabuloussites@.discussions.microsoft.com> wrote in message
> news:8EB1C476-23D7-4D56-9480-E69431317A46@.microsoft.com...
>
>