Try to explain this as simple as I can -
User provides a list (names, ID's, or ....) into a text box on a GUI
application...
Based on which options they select I have to look up the corresponding
values from our sql databases.
For example:
user provides:
adamsj
nimmow
dandekp
I need to return
nimmow 1234
dandekp 2341
adamsj <>
where nimmow and dandekp are actual employees and adamsj does not have
an ID
I need to do this for thousands of rows at a time, so I want to avoid
doing a for each with a select statement.
Whats the best way to get this data from SQL? Ive thought about doing
a for each through the list the user provides and appending on a "where
username in ('x','y','z')" to the end of a sql query and then just
getting the results back in a datatable, but then I would not get the
users who were not found in the list..
ideas?
thanks
will 7 1526
There are a few different ways to do this. The method you suggested works
well. You would need to keep track of those results that weren't returned
by the query. You could do that using a Generic.List or one of the other
Generic collections. Add all of the search strings to the list.
Dim allSearch As New Generic.List(Of String)
allSearch.Add(" adamsj")
allSearch.Add(" nimmow")
Then as you parse the results from your SQL query, delete the ones you find.
allSearch.Remov e(CStr(returned Table!ShortName ))
Anything left in the list will be your "<>" elements.
For Each oneEntry As String IN allSearch
myStringBuild.A ppendLine(oneen try & " <>")
Next oneEntry
You could also create a temporary SQL Server table with your search strings,
and join this table to the real table.
SELECT TT.SearchText, RT.ID
FROM ##MyTempTable AS TT LEFT JOIN RealTable AS RT
ON TT.SearchText = RT.ShortName
Any record that comes back with a NULL ID field is a "<>" entry. Don't forget
to remove the temporary table when you're finished with it.
-----
Tim Patrick
Start-to-Finish Visual Basic 2005
Try to explain this as simple as I can -
User provides a list (names, ID's, or ....) into a text box on a GUI
application...
Based on which options they select I have to look up the corresponding
values from our sql databases.
For example:
user provides:
adamsj
nimmow
dandekp
I need to return
nimmow 1234
dandekp 2341
adamsj <>
where nimmow and dandekp are actual employees and adamsj does not have
an ID
I need to do this for thousands of rows at a time, so I want to avoid
doing a for each with a select statement.
Whats the best way to get this data from SQL? Ive thought about doing
a for each through the list the user provides and appending on a
"where username in ('x','y','z')" to the end of a sql query and then
just getting the results back in a datatable, but then I would not get
the users who were not found in the list..
ideas?
thanks
will
I agree using a temp table would be preferrable.
Unfortunately that would require inserting all 10K rows into the
database, which would require 10K sql insert statements. Kinda defeats
the intention of reducing the number of SQL calls..
Your idea of removing systems as they are found is not bad.. I may look
into that.
Im just kinda surprised .net doesnt have some kind of method where you
could get all of the user's input into a single datatable and get the
other information into another datatable from SQl and then do some sort
of merge on the two datatables.
Im looking into the joinview class right now, but frankly it confuses
me.
What makes this even more complicated is that I have simplified the
problem.. The data I need to relate the input to actually resides on
two seperate servers that cannot be linked and have no common ID with
permissions to both..
so whatever I end up doing, I actually have to do twice..
fun stuff..
any more suggestions?
also - not using .net 2.0 yet.. is there a 1.1 equivalent of
generic.list?
nemo wrote:
I agree using a temp table would be preferrable.
Unfortunately that would require inserting all 10K rows into the
database, which would require 10K sql insert statements. Kinda defeats
the intention of reducing the number of SQL calls..
Your idea of removing systems as they are found is not bad.. I may look
into that.
Im just kinda surprised .net doesnt have some kind of method where you
could get all of the user's input into a single datatable and get the
other information into another datatable from SQl and then do some sort
of merge on the two datatables.
Im looking into the joinview class right now, but frankly it confuses
me.
What makes this even more complicated is that I have simplified the
problem.. The data I need to relate the input to actually resides on
two seperate servers that cannot be linked and have no common ID with
permissions to both..
so whatever I end up doing, I actually have to do twice..
fun stuff..
any more suggestions?
The classes in the System.Collecti ons namespace provide similar functionality
to the Generic collections, although they are not strongly typed.
-----
Tim Patrick
Start-to-Finish Visual Basic 2005
also - not using .net 2.0 yet.. is there a 1.1 equivalent of
generic.list?
nemo wrote:
>I agree using a temp table would be preferrable.
Unfortunatel y that would require inserting all 10K rows into the database, which would require 10K sql insert statements. Kinda defeats the intention of reducing the number of SQL calls..
Your idea of removing systems as they are found is not bad.. I may look into that.
Im just kinda surprised .net doesnt have some kind of method where you could get all of the user's input into a single datatable and get the other information into another datatable from SQl and then do some sort of merge on the two datatables.
Im looking into the joinview class right now, but frankly it confuses me.
What makes this even more complicated is that I have simplified the problem.. The data I need to relate the input to actually resides on two seperate servers that cannot be linked and have no common ID with permissions to both..
so whatever I end up doing, I actually have to do twice..
fun stuff..
any more suggestions?
You might want to ask a SQL Server newsgroup if there is a way to build a
table on the fly from a chunk of single-column data. I kind of doubt it--Oracle
doesn't have a feature like that in its standard DDL commands. But SQL Server
Data Transformation Services (DTS) is able to import tab-delimited data into
tables quick quickly, so there may be some advanced or back-door way to do
it.
-----
Tim Patrick
Start-to-Finish Visual Basic 2005
I agree using a temp table would be preferrable.
Unfortunately that would require inserting all 10K rows into the
database, which would require 10K sql insert statements. Kinda defeats
the intention of reducing the number of SQL calls..
Your idea of removing systems as they are found is not bad.. I may
look into that.
Im just kinda surprised .net doesnt have some kind of method where you
could get all of the user's input into a single datatable and get the
other information into another datatable from SQl and then do some
sort of merge on the two datatables.
Im looking into the joinview class right now, but frankly it confuses
me.
What makes this even more complicated is that I have simplified the
problem.. The data I need to relate the input to actually resides on
two seperate servers that cannot be linked and have no common ID with
permissions to both..
so whatever I end up doing, I actually have to do twice..
fun stuff..
any more suggestions?
"nemo" <mi*******@gmai l.comwrote in news:1162835614 .928309.289380
@f16g2000cwb.go oglegroups.com:
Unfortunately that would require inserting all 10K rows into the
database, which would require 10K sql insert statements. Kinda defeats
the intention of reducing the number of SQL calls..
You could bulk load the data using DTS or BCP.
Or just do the SELET * FROM USERS WHERE UserName in ('user1', 'user2', etc)
method - perhaps chunk the select into ~100 - 1000 users? Once you get the
datatable back - merge the data into a large datatable containing the
complete results?
Im just kinda surprised .net doesnt have some kind of method where you
could get all of the user's input into a single datatable and get the
other information into another datatable from SQl and then do some sort
of merge on the two datatables.
MS Linq will allow you to dynamically query data tables and join tables
together...but it's in alpha or beta.
nemo wrote:
Whats the best way to get this data from SQL? Ive thought about doing
a for each through the list the user provides and appending on a
"where username in ('x','y','z')" to the end of a sql query and then
Don't forget to escape apostrophes somehow (or use a stored procedure)
because otherwise that's going to fall over as soon as you get an employee
with an apostrophe in their name.
Andrew This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lapchien |
last post by:
done homework on Usenet and still stuck...
I have a parameter query that asks the user to input the 'slip reference'
based on the accounting period. This has now changed slightly so that the
slip reference number is based on the date, so for instance if the date is
as follows, the slip reference is as follows:
J12345 21/08/2003
J12346 22/08/2003
J12347 23/08/2003
|
by: John |
last post by:
Hi - I am trying to perform a simple append query, with no luck. I
have a table (MktPrices) that has the following fields: BondID,
PriceDate, Price. The objective is to allow the user to input a date
and have the append query create a new record for each BondID, using
the input date and the most recent price - which the user can then
update on a tabular form. I have created a totals query
(qryMostRecentPrice) which selects the most...
|
by: JJ |
last post by:
I have a Make Table query which uses a date parameter. Each time the
user runs the query they will be prompted for a date. The table which
is created should be named based on the date which they entered. For
example: The query will retieve all invoices dated xxxxx, the user
will may supply the date of Jan 1 2004. It should create a table
called "Jan 1 2004 Invoices" (or something like that). Each table
created needs to be saved in the...
|
by: Francis Debrabandere |
last post by:
Hi all,
I'm a beginner in ms access, and I'm working on my first real
application. But to finish it up I'm facing a problem. I'm not able to
solve and maybe someone can help me.
I have made a database that can be divided in two major parts:
1. entering data
2. reading the entered data.
Everybody who uses the database has access to the second part. The
|
by: Mark |
last post by:
I've run a few simple tests looking at how query string encoding/decoding gets handled in asp.net, and it seems like the situation is even messier than it was in asp... Can't say I think much of the "improvements", but maybe someone here can point me in the right direction...
First, it looks like asp.net will automatically read and recognize query strings encoded in utf8 and 16-bit unicode, only the latter is some mutant, non-standard...
| |
by: dath |
last post by:
Hi,
Searched the forum and found a lot on passing form input to aquery but not the other way around. Here is the situation:
I have a timesheet form based on a subform query that asks the user for the Month and their last name. The fields in the table being updated include: FY, Month, Employee ID, Task Number, hours. The query then displays the results in data sheet view on the form. I have been asked by users to display total they...
|
by: Chuck36963 |
last post by:
Hi all,
I've been working on a listing problem and I can't figure out how to work it out. I have looked far and wide on the web to find answers, but I'd like other peoples input on my project in the whole. I really need MySQL wizz to give me a hand (and maybe refer me to books to get me to the wizz level myself).
First off, english is a second language to me and sometimes my sentences might be a little awkward. Please forgive me. Mon...
|
by: commodityintelligence |
last post by:
Greetings,
I am merging a series of different tables into one query to export decision-making information. I have some architecture issues I need to ask for help on. I have no programming training.
I will explain my structure before asking my questions.
I have data from a table (updated monthly by adding the most current month’s data) that is evaluated by certain arithmetic, given an adjective to describe it, and then being exported...
|
by: Doris |
last post by:
It does not look like my message is posting....if this is a 2nd or 3rd
message, please forgive me as I really don't know how this site works.
I want to apologize ahead of time for being a novice with MS Access
and VBA. I desperately need help with 2 queries that I am trying to
put together. I want to thank anyone that can help me out with this
situation.
I want to put a select query(Query1) that uses one table and the
criteria would...
|
by: zion4ever |
last post by:
Hello good people,
Please bear with me as this is my first post and I am relative new to ASP. I do have VB6 experience. I have a form which enables users within our company to do an intranet reservation of available resources (laptops, beamers, etc). The MySql database queries are already in place, as is the ASP administration panel. The frontend that users will see however, still needs some work. I'm really close, but since I'm no...
|
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: 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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |