I've created a TableAdapter which implements the following SQL
statement
SELECT MSC.MSC_NAME AS NAME, Capacity.Capaci ty AS CAPACITY
FROM Capacity INNER JOIN
MSC ON Capacity.MSC_KE Y = MSC.MSC_KEY
WHERE (MSC.ED_MARKET_ KEY in ( @ED_MARKET_KEY) )
the type of the parameter @ED_MARKET_KEY is a string (varchar(40) in
the database). When @ED_MARKET_KEY is a single value everything works
fine (such as 5834934, however when @ED_MARKET_KEY is a comma delimited
list I get no matches.
What gives? I've tried putting the individual keys between single
quotes so that the list is '5328923','2349 328' but neither
5328923,2349328 or '5328923','2349 328' works. The
statement works fine with either list in SQL Server 2005 Standard
(which is the database I'm targeting).
Please help!!! 3 13173
Crazy,
You can't specify a comma delimited list as the value of a parameter.
Here is an article that discusses options: http://www.sommarskog.se/arrays-in-sql.html
Kerry Moorman
"Crazy Cat" wrote: I've created a TableAdapter which implements the following SQL statement SELECT MSC.MSC_NAME AS NAME, Capacity.Capaci ty AS CAPACITY FROM Capacity INNER JOIN MSC ON Capacity.MSC_KE Y = MSC.MSC_KEY WHERE (MSC.ED_MARKET_ KEY in ( @ED_MARKET_KEY) )
the type of the parameter @ED_MARKET_KEY is a string (varchar(40) in the database). When @ED_MARKET_KEY is a single value everything works fine (such as 5834934, however when @ED_MARKET_KEY is a comma delimited list I get no matches.
What gives? I've tried putting the individual keys between single quotes so that the list is '5328923','2349 328' but neither 5328923,2349328 or '5328923','2349 328' works. The statement works fine with either list in SQL Server 2005 Standard (which is the database I'm targeting).
Please help!!!
Yeah I've run into this problem before (with SQL Server 2000). You'll have
to take out the @parameter and do the classic good ol' SQL concatenation.
"where bla in (" + myDelimitedList + ")"
Kerry Moorman wrote: Crazy,
You can't specify a comma delimited list as the value of a parameter.
Here is an article that discusses options:
http://www.sommarskog.se/arrays-in-sql.html
Thanks. Kerry Moorman
"Crazy Cat" wrote:
I've created a TableAdapter which implements the following SQL statement SELECT MSC.MSC_NAME AS NAME, Capacity.Capaci ty AS CAPACITY FROM Capacity INNER JOIN MSC ON Capacity.MSC_KE Y = MSC.MSC_KEY WHERE (MSC.ED_MARKET_ KEY in ( @ED_MARKET_KEY) )
the type of the parameter @ED_MARKET_KEY is a string (varchar(40) in the database). When @ED_MARKET_KEY is a single value everything works fine (such as 5834934, however when @ED_MARKET_KEY is a comma delimited list I get no matches.
What gives? I've tried putting the individual keys between single quotes so that the list is '5328923','2349 328' but neither 5328923,2349328 or '5328923','2349 328' works. The statement works fine with either list in SQL Server 2005 Standard (which is the database I'm targeting).
Please help!!!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ZoeNeedsHelp |
last post by:
I have an asp.net application in C# and i'm trying to call
a stored procedure with a parameter. When i run the web
app i get this message:
Procedure 'sp_loadCustByID' expects
parameter '@CustomerID', which was not supplied.
How do i pass the parameter to my dataAdapter and into my
dataset. the parameter is entered by the user in a text
field.
|
by: lolomgwtf |
last post by:
I have a managed C++ method that wraps unmanaged code and creates a
managed object holding data retrieved form an unmanged one. I want
create an instance of this managed class in C#, pass it to this method
and have it set the instance to hold the right data.
>From what I've read it seems I should be able to pass C# objects to
managed C++ methods and it should just work; however, when I try it, my
C# instance comes out null. If I step...
|
by: lolomgwtf |
last post by:
I have a managed C++ method that wraps unmanaged code and creates a
managed object holding data retrieved form an unmanged one. I want
create an instance of this managed class in C#, pass it to this method
and have it set the instance to hold the right data.
>From what I've read it seems I should be able to pass C# objects to
managed C++ methods and it should just work; however, when I try it, my
C# instance comes out null. If I step...
|
by: John |
last post by:
Hi
I have a datadapter with the following SQL;
SELECT ID, Company, Status, CompanyType
FROM Companies
WHERE (@Status IS NULL or @Status = Status)
When I try to fill like so;
Me.CompanyTableAdapter.Fill(Me.MyDataSet.Clients, "Current"), it brings all
|
by: tg.foobar |
last post by:
i'd like to do the following, but i don't think it's possible. can you
help me find a way to do this, or maybe a better way to write the code?
I have a list of items that need to be modified based on their data and
some other data as well. i planned on passing it by reference into a
function that modified their values. but it gave me the error "you
cannot pass indexers and properties by reference". The only way i know
of doing it is...
| |
by: Programatix |
last post by:
Hi,
Have anyone ever benchmark the TableAdapter performance compared to
DataTable's Load method? I found out that the DataTable's Load method is
about 10x faster than TableAdapter's Fill method.
I used the same SELECT query and DataSet (predefined), for both test.
For the DataTable's Load method, we first need to create a DataReader.
|
by: Mike |
last post by:
Dear Group,
When I add a DataTable to a Typed Dataset, and a TableAdapter to the
DataTable, I am able to create methods to send updates directly to the
database (GenerateDBDirectMethods), however when my TableAdapter Fill SQL
contains a WHERE clause which looks up a field from another joined table,
the Fill works perfectly, but I cannot Insert, Update or Delete using the
TableAdapter.
Does anyone know why this is?
|
by: jrogers.sw |
last post by:
I am using an objectdatasource with a .Net 2.0 ASP page.
The SQL for the tableadapter needs to use the IN operator as in
WHERE job_id in (111, 222, 333, 444, 555)
Job_id is a DBType Decimal and ProviderType Number
I have set the default value for the parameter to be
19620,19610,19580,19550 for testing
However, .Net strips the , and turns it into one large number.
|
by: Chris |
last post by:
Ok, so I have this sub I wrote, and I create a new instance of a
UserControl:
ctrlAPs tempctrl = new ctrlAPs();
Now, I would like to be able to use this sub I wrote for more than one
UserControl, so I was trying to do something like this:
private void somesub(UserControl sourcectrl)
{
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |