How to retrieve user id from current SQL connection 
Author Message
 How to retrieve user id from current SQL connection

It appears that my understanding of SQLGETPROP() is a tad flawed so I'm
hoping someone can shed some light and offer some advice.

My VFP7 app is using a SQL Server back end. When the app loads, a
SQLCONNECT() is done without passing any user-id/password info to have the
user login to the database. I was expecting to be able to retrieve the
current userid by calling SQLGETPROP(nHandle, "UserID"). Apparently this is
not the case when SQLCONNECT is used without any arguments. Why is that?

In any case, given that this is the current behaviour can someone recommend
how I would be able to retrieve the user id that is in use by the current
connection? The reason I'm doing this is to look up the user and/or group
name against the table privileges to determine which form buttons are
enabled.

Jon



Sun, 04 Sep 2005 06:09:20 GMT  
 How to retrieve user id from current SQL connection
DOH! Answered my own question. Using either USER_NAME or CURRENT_USER from
SQL Server gets me what I want.

Jon


Quote:
> It appears that my understanding of SQLGETPROP() is a tad flawed so I'm
> hoping someone can shed some light and offer some advice.

> My VFP7 app is using a SQL Server back end. When the app loads, a
> SQLCONNECT() is done without passing any user-id/password info to have the
> user login to the database. I was expecting to be able to retrieve the
> current userid by calling SQLGETPROP(nHandle, "UserID"). Apparently this
is
> not the case when SQLCONNECT is used without any arguments. Why is that?

> In any case, given that this is the current behaviour can someone
recommend
> how I would be able to retrieve the user id that is in use by the current
> connection? The reason I'm doing this is to look up the user and/or group
> name against the table privileges to determine which form buttons are
> enabled.

> Jon



Sun, 04 Sep 2005 06:16:27 GMT  
 How to retrieve user id from current SQL connection
Also SYSTEM_USER might be of interest for you.

HTH,
Remus


Quote:
> DOH! Answered my own question. Using either USER_NAME or CURRENT_USER from
> SQL Server gets me what I want.

> Jon



> > It appears that my understanding of SQLGETPROP() is a tad flawed so I'm
> > hoping someone can shed some light and offer some advice.

> > My VFP7 app is using a SQL Server back end. When the app loads, a
> > SQLCONNECT() is done without passing any user-id/password info to have
the
> > user login to the database. I was expecting to be able to retrieve the
> > current userid by calling SQLGETPROP(nHandle, "UserID"). Apparently this
> is
> > not the case when SQLCONNECT is used without any arguments. Why is that?

> > In any case, given that this is the current behaviour can someone
> recommend
> > how I would be able to retrieve the user id that is in use by the
current
> > connection? The reason I'm doing this is to look up the user and/or
group
> > name against the table privileges to determine which form buttons are
> > enabled.

> > Jon



Sun, 04 Sep 2005 13:41:11 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Obtaining current user ID

2. Not Retrieving Current Date

3. Progress bar for user while retrieving remote view

4. How to retrieve a user information fromexchange server?

5. NT User Id's

6. Novell 3.11 User ID capture??

7. Need to ID user from Novell 3.12 without RUN

8. Need to ID user from Novell 3.12 without RUN

9. How to get USER ID from netork

10. SQL Server Connection Problem using SQL Pass-Through

11. How to get the network user-id (again)

12. How to get user id - Novell

 

 
Powered by phpBB® Forum Software