Solved

TableAdapter parameter with multiple values

Posted on 2007-11-14
1
1,475 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Set custom font WPF 2 25
Find unused columns in a table 12 94
Pdf not loading 2 39
Unprotect Visio drawing page in C# 4 19
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 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