Solved

TableAdapter parameter with multiple values

Posted on 2007-11-14
1
1,446 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
Comment Utility
you should use dynamic sql

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

8 Experts available now in Live!

Get 1:1 Help Now