Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

how get the PC's domain name and username in PBscript

3 posts in Powerscript Last posting was on 2009-09-11 12:04:38.0Z
Chris Fauvel Posted on 2009-09-10 17:39:22.0Z
From: Chris Fauvel <avachet1965@gmail.com>
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: how get the PC's domain name and username in PBscript
Date: Thu, 10 Sep 2009 10:39:22 -0700 (PDT)
Organization: http://groups.google.com
Lines: 27
Message-ID: <12cf9620-9513-4d3b-a2d2-249da11aa8e5@v36g2000yqv.googlegroups.com>
NNTP-Posting-Host: 64.203.106.198
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1252604363 6434 127.0.0.1 (10 Sep 2009 17:39:23 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 10 Sep 2009 17:39:23 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: v36g2000yqv.googlegroups.com; posting-host=64.203.106.198; posting-account=DJjFPAoAAAAeQvDjk3ABu2l0irywGuZP
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; MS-RTC LM 8; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; yie8),gzip(gfe),gzip(gfe)
Path: forums-1-dub!forums-master!newssvr.sybase.com!news-sj-1.sprintlink.net!news-peer1.sprintlink.net!nntp1.phx1.gblx.net!nntp.gblx.net!nntp.gblx.net!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!v36g2000yqv.googlegroups.com!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27055
Article PK: 793529

Trying to migrate to using windows authentication to connect to the
MSSQL 2005 server and got it connected fine ignoring what I type in
the PFC LOGON window (dbparm= TrustedConnection=1).

In our About window I display the user and some DB connection info and
want to display the proper user name

//This gets my expected result of ANSWERS\ansclf
select top 1 Suser_Sname()
into :sqlca.logid
from bto_client
using sqlca;


//this gets just the username ansclf
n_cst_platform lnv_platform
f_SetPlatform(lnv_platform, TRUE)
sqlca.logid = lnv_platform.of_getuserid( )



I'd rather get ANSWERS\ansclf directly from the PC rather than doing a
DB call.

can anyone help ?

Chris


Scott Morris Posted on 2009-09-10 17:45:40.0Z
From: "Scott Morris" <bogus@bogus.com>
Newsgroups: sybase.public.powerbuilder.powerscript
References: <12cf9620-9513-4d3b-a2d2-249da11aa8e5@v36g2000yqv.googlegroups.com>
Subject: Re: how get the PC's domain name and username in PBscript
Lines: 8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4aa93b44$1@forums-1-dub>
Date: 10 Sep 2009 10:45:40 -0700
X-Trace: forums-1-dub 1252604740 10.22.241.152 (10 Sep 2009 10:45:40 -0700)
X-Original-Trace: 10 Sep 2009 10:45:40 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27056
Article PK: 793525


> I'd rather get ANSWERS\ansclf directly from the PC rather than doing a
> DB call.

Try the "extended" version of the windows API - GetUserNameEx

http://msdn.microsoft.com/en-us/library/ms724435(VS.85).aspx


Roland Smith [TeamSybase] Posted on 2009-09-11 12:04:38.0Z
From: "Roland Smith [TeamSybase]" <rsmith_at_trusthss_dot_com>
Newsgroups: sybase.public.powerbuilder.powerscript
References: <12cf9620-9513-4d3b-a2d2-249da11aa8e5@v36g2000yqv.googlegroups.com>
Subject: Re: how get the PC's domain name and username in PBscript
Lines: 37
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4aaa3cd6$1@forums-1-dub>
Date: 11 Sep 2009 05:04:38 -0700
X-Trace: forums-1-dub 1252670678 10.22.241.152 (11 Sep 2009 05:04:38 -0700)
X-Original-Trace: 11 Sep 2009 05:04:38 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27058
Article PK: 793531

http://www.topwizprogramming.com/freecode_netquery.html

The function of_NetWkstaGetInfo will give you Domain Name. The function
of_WNetGetUser will give you User Name.

"Chris Fauvel" <avachet1965@gmail.com> wrote in message
news:12cf9620-9513-4d3b-a2d2-249da11aa8e5@v36g2000yqv.googlegroups.com...
> Trying to migrate to using windows authentication to connect to the
> MSSQL 2005 server and got it connected fine ignoring what I type in
> the PFC LOGON window (dbparm= TrustedConnection=1).
>
> In our About window I display the user and some DB connection info and
> want to display the proper user name
>
> //This gets my expected result of ANSWERS\ansclf
> select top 1 Suser_Sname()
> into :sqlca.logid
> from bto_client
> using sqlca;
>
>
> //this gets just the username ansclf
> n_cst_platform lnv_platform
> f_SetPlatform(lnv_platform, TRUE)
> sqlca.logid = lnv_platform.of_getuserid( )
>
>
>
> I'd rather get ANSWERS\ansclf directly from the PC rather than doing a
> DB call.
>
> can anyone help ?
>
> Chris