Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TableAdapter parameter with multiple values

Posted on 2007-11-14
1
Medium Priority
?
1,490 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 2000 total points
ID: 20279719
you should use dynamic sql

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

670 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