Showing posts with label uid. Show all posts
Showing posts with label uid. Show all posts

Wednesday, March 21, 2012

Retrieving ODBC Settings.

I'm having some issues grabbing ODBC Settings. First off I need to
present a user with the options to select thier DSN, Server, UID, PWD, and
Database settings. I have come up with a way using the SQLBrowseConnect
function to obtain the Server and Database information I need. Therefore, I
have a semi working version of the program.
I just need a way to make the program a little more user
friendly/fool-proof. I know that there is an option in the ODBC settings to
set an default database. I need a way of retrieving this setting and the
default server as well. Lastly I would like to turn a text box I am currently
using for the DSN name into a dropdown box that contains a list of all
available DSNs. What functions are available to help me poll this list? I'm
really just interested in those DSN's listed under System DSNs in the Data
Source (ODBC).
See the below article for the example I used to model my program thrus far:
http://msdn.microsoft.com/library/de...datasource.asp
Let me know if I was not clear in my explains. Any help would be appreciated.
Bill
P.S. I'm cross posted this because I'm not exactly sure where it belongs.
You can retrieve the specific settings for a DSN as well as
the existing DNSs by reading the registry - that's where
they are all stored. Check the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
-Sue
On Mon, 12 Sep 2005 17:22:01 -0700, "Billr17"
<Billr17@.discussions.microsoft.com> wrote:

> I'm having some issues grabbing ODBC Settings. First off I need to
>present a user with the options to select thier DSN, Server, UID, PWD, and
>Database settings. I have come up with a way using the SQLBrowseConnect
>function to obtain the Server and Database information I need. Therefore, I
>have a semi working version of the program.
> I just need a way to make the program a little more user
>friendly/fool-proof. I know that there is an option in the ODBC settings to
>set an default database. I need a way of retrieving this setting and the
>default server as well. Lastly I would like to turn a text box I am currently
>using for the DSN name into a dropdown box that contains a list of all
>available DSNs. What functions are available to help me poll this list? I'm
>really just interested in those DSN's listed under System DSNs in the Data
>Source (ODBC).
>See the below article for the example I used to model my program thrus far:
>http://msdn.microsoft.com/library/de...datasource.asp
>Let me know if I was not clear in my explains. Any help would be appreciated.
>Bill
>P.S. I'm cross posted this because I'm not exactly sure where it belongs.
>
|||Thank you Sue. This looks like what I was searching for.
Bill
"Sue Hoegemeier" wrote:

> You can retrieve the specific settings for a DSN as well as
> the existing DNSs by reading the registry - that's where
> they are all stored. Check the following key:
> HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
> -Sue
> On Mon, 12 Sep 2005 17:22:01 -0700, "Billr17"
> <Billr17@.discussions.microsoft.com> wrote:
>
>
|||Bill,
Simplest way to fill this list is to use 'SQLDataSources' ODBC API call.
B> a text box I am currently using for the DSN name into a dropdown box
B> that contains a list of all available DSNs. What functions are
B> available to help me poll this list? I'm really just interested in
Igor Shekalev, www.sqledit.com - powerful database tools
|||Thank you for the info, that should easily get me what I need for the
dropdown box. Sues post with the registry key allowed me to retrieve the
default settings and set each controls default value appropriately. I was
going to write some code to pull the DSN's from the registry to, but I think
'SQLDataSources' might be safer. :-)
Bill
"Igor Shekalev" wrote:

> Bill,
> Simplest way to fill this list is to use 'SQLDataSources' ODBC API call.
> B> a text box I am currently using for the DSN name into a dropdown box
> B> that contains a list of all available DSNs. What functions are
> B> available to help me poll this list? I'm really just interested in
> Igor Shekalev, www.sqledit.com - powerful database tools
>
>
|||Billr,
You are right , it is really safer. As far I know, 2003 server uses registry
entries for DSN a little differently (may be uses ODBC.INI subkey for some
other cases).
B> Thank you for the info, that should easily get me what I need for the
B> dropdown box. Sues post with the registry key allowed me to retrieve
B> the default settings and set each controls default value
B> appropriately. I was going to write some code to pull the DSN's from
B> the registry to, but I think 'SQLDataSources' might be safer. :-)
B> Bill
Igor Shekalev, www.sqledit.com - powerful database tools
sql

Retrieving ODBC Settings.

I'm having some issues grabbing ODBC Settings. First off I need to
present a user with the options to select thier DSN, Server, UID, PWD, and
Database settings. I have come up with a way using the SQLBrowseConnect
function to obtain the Server and Database information I need. Therefore, I
have a semi working version of the program.
I just need a way to make the program a little more user
friendly/fool-proof. I know that there is an option in the ODBC settings to
set an default database. I need a way of retrieving this setting and the
default server as well. Lastly I would like to turn a text box I am currentl
y
using for the DSN name into a dropdown box that contains a list of all
available DSNs. What functions are available to help me poll this list? I'm
really just interested in those DSN's listed under System DSNs in the Data
Source (ODBC).
See the below article for the example I used to model my program thrus far:
http://msdn.microsoft.com/library/d...edatasource.asp
Let me know if I was not clear in my explains. Any help would be appreciated
.
Bill
P.S. I'm cross posted this because I'm not exactly sure where it belongs.You can retrieve the specific settings for a DSN as well as
the existing DNSs by reading the registry - that's where
they are all stored. Check the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
-Sue
On Mon, 12 Sep 2005 17:22:01 -0700, "Billr17"
<Billr17@.discussions.microsoft.com> wrote:

> I'm having some issues grabbing ODBC Settings. First off I need to
>present a user with the options to select thier DSN, Server, UID, PWD, and
>Database settings. I have come up with a way using the SQLBrowseConnect
>function to obtain the Server and Database information I need. Therefore, I
>have a semi working version of the program.
> I just need a way to make the program a little more user
>friendly/fool-proof. I know that there is an option in the ODBC settings to
>set an default database. I need a way of retrieving this setting and the
>default server as well. Lastly I would like to turn a text box I am current
ly
>using for the DSN name into a dropdown box that contains a list of all
>available DSNs. What functions are available to help me poll this list? I'm
>really just interested in those DSN's listed under System DSNs in the Data
>Source (ODBC).
>See the below article for the example I used to model my program thrus far:
>http://msdn.microsoft.com/library/d...edatasource.asp
>Let me know if I was not clear in my explains. Any help would be appreciate
d.
>Bill
>P.S. I'm cross posted this because I'm not exactly sure where it belongs.
>|||Thank you Sue. This looks like what I was searching for.
Bill
"Sue Hoegemeier" wrote:

> You can retrieve the specific settings for a DSN as well as
> the existing DNSs by reading the registry - that's where
> they are all stored. Check the following key:
> HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI
> -Sue
> On Mon, 12 Sep 2005 17:22:01 -0700, "Billr17"
> <Billr17@.discussions.microsoft.com> wrote:
>
>|||Bill,
Simplest way to fill this list is to use 'SQLDataSources' ODBC API call.
B> a text box I am currently using for the DSN name into a dropdown box
B> that contains a list of all available DSNs. What functions are
B> available to help me poll this list? I'm really just interested in
Igor Shekalev, www.sqledit.com - powerful database tools|||Thank you for the info, that should easily get me what I need for the
dropdown box. Sues post with the registry key allowed me to retrieve the
default settings and set each controls default value appropriately. I was
going to write some code to pull the DSN's from the registry to, but I think
'SQLDataSources' might be safer. :-)
Bill
"Igor Shekalev" wrote:

> Bill,
> Simplest way to fill this list is to use 'SQLDataSources' ODBC API call.
> B> a text box I am currently using for the DSN name into a dropdown box
> B> that contains a list of all available DSNs. What functions are
> B> available to help me poll this list? I'm really just interested in
> Igor Shekalev, www.sqledit.com - powerful database tools
>
>|||Billr,
You are right , it is really safer. As far I know, 2003 server uses registry
entries for DSN a little differently (may be uses ODBC.INI subkey for some
other cases).
B> Thank you for the info, that should easily get me what I need for the
B> dropdown box. Sues post with the registry key allowed me to retrieve
B> the default settings and set each controls default value
B> appropriately. I was going to write some code to pull the DSN's from
B> the registry to, but I think 'SQLDataSources' might be safer. :-)
B> Bill
Igor Shekalev, www.sqledit.com - powerful database tools

Tuesday, February 21, 2012

Retrieve first record

I have a table of payments with these columns:

PaymentDate,UID,Item,Amount,Status,TransactionID

I'd like to retrieve the first instance of each purchase by a user (UID) where Status is "Completed".

For example

1/1/2003,10,Socks,7,Pending,1001
1/1/2003,10,Socks,7,Completed,1002
1/2/2003,11,Shirt,20,Pending,1003
1/2/2003,11,Shirt,20,Completed,1004
1/3/2003,11,Pants,30,Completed,1005

should return:

1/1/2003,10,Socks,7,Completed,1002
1/2/2003,11,Shirt,20,Completed,1004select columns
from table t
where rowid = (select min(rowid) from table where t.key = key);|||Originally posted by r123456
select columns
from table t
where rowid = (select min(rowid) from table where t.key = key);
Thanks for the reply but forgive me for being a newbie. I tried

SELECT ID,PaymentDate,UID,AID,ItemNumber,Username,Payment Status,TxnID FROM transactions where UID = (select min(UID) from table where transactions.UID = UID)

and I get

[Microsoft][ODBC Microsoft Access Driver] Syntax error. in query expression 'UID = (select min(UID) from table where transactions.UID = UID)'.|||select PaymentDate
, UID
, Item
, Amount
, Status
, TransactionID
from transactions FOO
where Status = 'Completed'
and PaymentDate
= ( select min(PaymentDate)
from transactions
where Status = 'Completed'
and UID = FOO.UID ) rudy
http://r937.com|||Originally posted by r937
select PaymentDate
, UID
, Item
, Amount
, Status
, TransactionID
from transactions FOO
where Status = 'Completed'
and PaymentDate
= ( select min(PaymentDate)
from transactions
where Status = 'Completed'
and UID = FOO.UID ) rudy
http://r937.com

It's a winner! Thank you!

I thought this could be done with some form of TOP and/or GROUP BY but I spent all morning trying different incarnations with no luck. Thanks again for your help.