Solved

TableAdapter parameter with multiple values

Posted on 2007-11-14
1
1,449 Views
Last Modified: 2008-02-01
I have a TableAdapter Query for which I would like to pass a parameter with multiple values.

The underlying query uses a " .... WHERE A in (@Values)......" type command.

Field "A" is of type int

I've changed the parameter type of the parameter to string to allow me to pass a value like "1,2,3"

However, when I execute the query, I get a "Conversion failed when converting the varchar value '1,2,3' to data type int" error.

ANY help / advice would be appreciated, even if I have to use other objects instead of the genereated TableAdapters.
0
Comment
Question by:benjvr
1 Comment
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 20279719
you should use dynamic sql

exec (' select ............  where a in (' + @values +' )'   )
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now