|
 |
asp_databases thread: Re: asp - i want to get the first charachter from the record set
Message #1 by "Ajay Ovalekar" <ajax@i...> on Sun, 17 Sep 2000 20:30:26 +0530
|
|
I would rather do this :-
set re=con.execute ("select left(first_name,1) from user_tab where
user_id='M999'")
{assuming ofcourse that the field user_id is storing the primary key/ unique
key of the table user_tab}
Once i do this, i need not do any juggling in ASP (front end)
cheerio!
ajax
----- Original Message -----
From: Alberto Jacomuzzi <ajacomuzzi@w...>
To: ASP Databases <asp_databases@p...>
Sent: Wednesday, August 30, 2000 2:39 PM
Subject: [asp_databases] Re: 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
> >
>
> 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
>
>
> ---
> You are currently subscribed to asp_databases
$subst('Email.Unsub')
>
Message #2 by Imar Spaanjaars <Imar@S...> on Tue, 26 Sep 2000 15:55:32 +0200
|
|
Or even better, let SQL to the cutting of the name, and only return the
first char (provided you don't need the rest of the name in the ASP page.
This will save some unnecessary data transfer.
Use substring. This is the syntax: SUBSTRING(expression, start, length)
sSQL = "SELECT SUBSTRING(first_name, 1, 1) will return only the first char
of the first name.
Imar
At 08:30 PM 9/17/2000 +0530, you wrote:
>I would rather do this :-
>
>set re=con.execute ("select left(first_name,1) from user_tab where
>user_id='M999'")
>
>{assuming ofcourse that the field user_id is storing the primary key/ unique
>key of the table user_tab}
>
>Once i do this, i need not do any juggling in ASP (front end)
>
>cheerio!
>ajax
>
>
>
>----- Original Message -----
>From: Alberto Jacomuzzi <ajacomuzzi@w...>
>To: ASP Databases <asp_databases@p...>
>Sent: Wednesday, August 30, 2000 2:39 PM
>Subject: [asp_databases] Re: 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
> > >
> >
> > 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
> >
> >
|
|
 |