Hello,
I have an sproc to query a couple of tables, that have the same fieldnames,
for example DateCreated.
-------------------------------------
Select a.* , b.* From tablea a
Join table b On b.keyfield = a.keyfield
-------------------------------------
Now table A and B both have a field called "DateCreate d", and I need both
values in my application.
-------------------------------------
.....-- New DataReader dr --....
.....-- query --....
DateCreatedA = dr.Item("a.Date Created")
DateCreatedB = dr.Item("b.Date Created")
-------------------------------------
Doesn't seem to work, but
-------------------------------------
SomeVariable = dr.Item("DateCr eated")
-------------------------------------
does work, but only for one value...
When I check the resultset in Query Analyzer, it shows duplicate fieldnames,
so that's probably why the DR doesn't swallow my brave attempts with
"a.DateCrea ted" and "b.Da..."
Can someone help me out getting both values ?
Beren. 3 1987
Beren,
It really isn't good design to have * pulled from a table. You should also
give each returning column a unique name. Otherwise it will pull the first
occurrece when you use dr.Item("DateCr eated").
All the columns are in there.
for i = 0 to dr.FieldCount
Response.Write( dr.GetName( i ) )
next
it will list all the field names and show two for DateCreated.
So you could reference each of the DateCreated columns by using the ordinal.
HTH,
bill
"Beren" <be***@angband. me> wrote in message
news:xb******** *************@p hobos.telenet-ops.be... Hello,
I have an sproc to query a couple of tables, that have the same
fieldnames, for example DateCreated.
------------------------------------- Select a.* , b.* From tablea a Join table b On b.keyfield = a.keyfield -------------------------------------
Now table A and B both have a field called "DateCreate d", and I need both values in my application.
------------------------------------- ....-- New DataReader dr --.... ....-- query --.... DateCreatedA = dr.Item("a.Date Created") DateCreatedB = dr.Item("b.Date Created") -------------------------------------
Doesn't seem to work, but
------------------------------------- SomeVariable = dr.Item("DateCr eated") -------------------------------------
does work, but only for one value...
When I check the resultset in Query Analyzer, it shows duplicate
fieldnames, so that's probably why the DR doesn't swallow my brave attempts with "a.DateCrea ted" and "b.Da..."
Can someone help me out getting both values ?
Beren.
The simplest way is to access these fields (especially the
second DateCreated) by index.
Elton Wang el********@hotm ail.com -----Original Message----- Hello,
I have an sproc to query a couple of tables, that have
the same fieldnames,for example DateCreated.
------------------------------------- Select a.* , b.* From tablea a Join table b On b.keyfield = a.keyfield -------------------------------------
Now table A and B both have a field called "DateCreate d",
and I need bothvalues in my application.
------------------------------------- .....-- New DataReader dr --.... .....-- query --.... DateCreatedA = dr.Item("a.Date Created") DateCreatedB = dr.Item("b.Date Created") -------------------------------------
Doesn't seem to work, but
------------------------------------- SomeVariable = dr.Item("DateCr eated") -------------------------------------
does work, but only for one value...
When I check the resultset in Query Analyzer, it shows
duplicate fieldnames,so that's probably why the DR doesn't swallow my brave
attempts with"a.DateCreated " and "b.Da..."
Can someone help me out getting both values ?
Beren.
.
Thanks for the suggestions.
it's solved.
Thanks,
Beren
"Beren" <be***@angband. me> wrote in message
news:xb******** *************@p hobos.telenet-ops.be... Hello,
I have an sproc to query a couple of tables, that have the same fieldnames, for example DateCreated.
------------------------------------- Select a.* , b.* From tablea a Join table b On b.keyfield = a.keyfield -------------------------------------
Now table A and B both have a field called "DateCreate d", and I need both values in my application.
------------------------------------- ....-- New DataReader dr --.... ....-- query --.... DateCreatedA = dr.Item("a.Date Created") DateCreatedB = dr.Item("b.Date Created") -------------------------------------
Doesn't seem to work, but
------------------------------------- SomeVariable = dr.Item("DateCr eated") -------------------------------------
does work, but only for one value...
When I check the resultset in Query Analyzer, it shows duplicate fieldnames, so that's probably why the DR doesn't swallow my brave attempts with "a.DateCrea ted" and "b.Da..."
Can someone help me out getting both values ?
Beren. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Josep |
last post by:
Hi,
I'd like to poll a database and get the table contents, as well as the field
names from that table. I've been to php.net but this time I cannot find
something helpful.
I can get the data, and retrieve it into an array noproblem.
I can get the data+fieldnames and put it into a list.
|
by: |
last post by:
How do I get to the fieldnames of a table in a recordset?
I have a recordset which I output into HTML.
And on data from certian columns I need to perform different actions.
I would like to use the fieldnames rather then theit sequential numbers, to
avoid the need to re-do the code if another field is inserted into the
table.
|
by: Little PussyCat |
last post by:
Hello,
I have had a request, one of our tables is used as a report and I have been
asked that all fieldnames for months have dashes in them,
like Jan-05 instead of Jan05 and so on...
Now what we have is a CURSOR which loops through all values in another table
generating these fieldnames, like 'Jan-05', Feb-05' etc..
Then the table definition is modified so these months display as fieldnames.
|
by: Jay Balapa |
last post by:
Hello,
Iam creating a query page, in which a Drop Down List will have collection of
fieldnames.
Is there a elegant way of doing it?
Currently Iam opening up a datareader and using GetName()/FieldCount() to
get to fieldnames.
|
by: Mark |
last post by:
Hi all, quick question , a DataView is
memory resident "view" of data in a data table therefore once populated you
can close the connection to the database. Garbage collection can then be
used to "clean up" the DataView once it is not referenced and will not
effect the number of connections to the database.
A DataReader on the other hand always maintains a connection to the database
and must be explicitly closed (Do not rely on garbage...
| |
by: Brent |
last post by:
I'm having a hard time wrapping my head around how to build a
multi-dimensional array of n length out of a DataReader loop. Take this
pseudo-code:
=======================================
public string get_array(string sql)
{
//create db connection & open
|
by: Miles Keaton |
last post by:
Is there a simple way to list fieldnames in a table, from PHP?
When on the command-line, I just do \d tablename
But how to get the fieldnames from PHP commands?
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
|
by: Gerrit |
last post by:
Hello,
I try to display the fieldnames and the primary key of a table, with this
code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Odbc;
|
by: john |
last post by:
In the query builder I made an edit-query in which I have linked table A to
table B on IDnr. For every record that matches I want 5 fields of table A to
get the values of corresponding fields in table B. I'm able to make this
query but only by typing the table B fieldnames in the 'change to'-row. Is
there some easy way to drag those fieldnames to that row or another way to
make this easier?
Thanks,
john
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: 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.
| |