|
 |
asp_databases thread: asp - i want to get the first charachter from the record set
Message #1 by "yanti fitri eka zalti" <yanti_fitri@l...> on Tue, 29 Aug 2000 19:56:43 -0700
|
|
hi,
what should I write in asp if i want to get the first charachter from the record set
like this;
set con=server.createobject("adodb.connection")
con.open "dsn=net"
set re=con.execute ("select first_name from user_tab where user_id='M999'")
'----
here i want to get the first character from the first_name
'-----
thanks
Message #2 by Yoram Zehavi <YoramZ@i...> on Wed, 30 Aug 2000 10:40:20 +0200
|
|
if not isnull(re("first_name")) then firstchar = left(re("first_name"),1)
[ or mid(re("first_name"),1,1) ]
-----Original Message-----
From: yanti fitri eka zalti [mailto:yanti_fitri@l...]
Sent: Wednesday, August 30, 2000 4:57 AM
To: ASP Databases
Subject: [asp_databases] asp - i want to get the first charachter from
the record set
hi,
what should I write in asp if i want to get the first charachter from the
record set
like this;
set con=server.createobject("adodb.connection")
con.open "dsn=net"
set re=con.execute ("select first_name from user_tab where user_id='M999'")
'----
here i want to get the first character from the first_name
'-----
thanks
---
You are currently subscribed to asp_databases
Message #3 by Mark Everest <Mark.Everest@t...> on Wed, 30 Aug 2000 09:07:27 +0100
|
|
Just perform a left() on the first field....
if not re.eof then
sChar = left(re.fields("first_name"), 1)
end if
-----Original Message-----
From: yanti fitri eka zalti [mailto:yanti_fitri@l...]
Sent: 30 August 2000 03:57
To: ASP Databases
Subject: [asp_databases] asp - i want to get the first charachter from
the record set
hi,
what should I write in asp if i want to get the first charachter from the
record set
like this;
set con=server.createobject("adodb.connection")
con.open "dsn=net"
set re=con.execute ("select first_name from user_tab where user_id='M999'")
'----
here i want to get the first character from the first_name
'-----
thanks
---
You are currently subscribed to asp_databases
Message #4 by Chris Neale <Chris.Neale@s...> on Wed, 30 Aug 2000 09:52:39 +0100
|
|
Depends on the language you're using in the ASP.. in Vbscript it'd be
left(first_name, 1).. in PerlScript it'd be left(1, first_name); (or
substr(0,1,first_name)); and in JavaScript.. can't remember.
Chris
PS If it's the PerlScript I'd check it first.. I might be wrong.. memory
like.. one of those things for vegetables..
Chaos! Panic! Disaster! (My work here is done)
Chris Neale. Web/Wap Developer
Chris.neale@s... <mailto:Chris.neale@s...>
www.sparkresponse.co.uk
-----Original Message-----
From: yanti fitri eka zalti
Sent: Wednesday, August 30, 2000 3:57 AM
To: ASP Databases
Subject: [asp_databases] asp - i want to get the first
charachter from the record set
hi,
what should I write in asp if i want to get the first charachter
from the record set
like this;
set con=server.createobject("adodb.connection")
con.open "dsn=net"
set re=con.execute ("select first_name from user_tab where
user_id='M999'")
'----
here i want to get the first character from the first_name
'-----
thanks
Message #5 by "Alberto Jacomuzzi" <ajacomuzzi@w...> on Wed, 30 Aug 2000 11:09:34 +0200
|
|
> hi,
> what should I write in asp if i want to get the first charachter from the
record set
> like this;
>
> set con=server.createobject("adodb.connection")
> con.open "dsn=net"
> set re=con.execute ("select first_name from user_tab where
user_id='M999'")
> '----
> here i want to get the first character from the first_name
>
You have to declare a varible like the following one:
firstChar = Left(rs("first_name"),1 )
And you have the first char of the first_name
Bye
Jaco
Message #6 by Biswajit <biswajit@v...> on Wed, 30 Aug 2000 15:07:52 +0530
|
|
Declare a variable x
X=left(re!first_name,1)
X holds the first character of first_name
-----Original Message-----
From: yanti fitri eka zalti [SMTP:yanti_fitri@l...]
Sent: Wednesday, August 30, 2000 8:27 AM
To: ASP Databases
Subject: [asp_databases] asp - i want to get the first charachter from the record set
hi,
what should I write in asp if i want to get the first charachter from the record set
like this;
set con=server.createobject("adodb.connection")
con.open "dsn=net"
set re=con.execute ("select first_name from user_tab where user_id='M999'")
'----
here i want to get the first character from the first_name
'-----
thanks
---
You are currently subscribed to asp_databases
Message #7 by Imar Spaanjaars <Imar@S...> on Wed, 30 Aug 2000 14:55:53 +0200
|
|
Another solution would be to get the first char only IN the recordset.
Of course this depends on the needs for the rest of the data in the column
in your ASP page.
If, however, all you are going to use is the first char, let SQL server (or
any other source) only return the first char, like this:
Select SUBSTRING(expression, start, length)
All values are required, so you probably do something like this:
Select LastName, SUBSTRING(FirstName, 1, 1) as FirstChar FROM tblUser
WHERE.....
This saves networkbandwith because you minimize the data sent.
Hope this helps.
Imar
At 07:56 PM 8/29/2000 -0700, you wrote:
>hi,
> what should I write in asp if i want to get the first charachter from
> the record set
>like this;
>
>set con=server.createobject("adodb.connection")
>con.open "dsn=net"
>set re=con.execute ("select first_name from user_tab where user_id='M999'")
>'----
>here i want to get the first character from the first_name
>
>
>'-----
>thanks
>
>
>---
>You are currently subscribed to asp_databases
|
|
 |