Ask a Question related to ASP Database, Design and Development.
-
Aaron Bertrand - MVP #1
Re: Bringing a Timestamp into a recordset
Timestamp isn't really "data" ... it is just a binary rowversion. What are
you trying to gain by displaying it on the page?
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
"Laphan" <news@DoNotEmailMe.co.uk> wrote in message
news:ebOEGDN9DHA.2604@TK2MSFTNGP10.phx.gbl...a> Hi Guys
>
> The subject of this post might be misleading, but basically I have createdselect> basic query ASP page that will allow a user to copy and paste their SQL
> query into a textbox so that they can execute it on their SQL DB to bring
> back the result.
>
> Now I understand how to dynamically bring back the relevant data cols and
> rows, but the only bit that I fall foul on is if the user has done a> * from a table and brings back a timestamp field.
>
> For some reason when my recordset tries to display this timestamp it blows
> up, which is unlike say MS Query that displays the figure.
>
> Is there a special encapsulating command that I have to wrap the recordset
> in so that it can handle the displaying of timestamps?
>
> Rgds
>
> Laphan
>
>
Aaron Bertrand - MVP Guest
-
Bringing xml data into flash
I would like to know how to bring xml data into flash. Specifically images that someone can click on the thumbnail and view the larger image. please... -
int4 -> unix timestamp -> sql timestamp; abstime?
Hello, what is the opposite of cast(extract('epoch' from now()) as int)? The only thing I found that works is cast(cast(... as abstime) as... -
bringing 3d to director
I was wondering how if i create something in 3d studio max do i bring it into director and then make it so i could make like say a box naviagte... -
Bringing XML Data into FMP
I am in the midst of figuring out how to integrate RF-ID into FileMaker. For those who are not familiar with RD-ID, it is the technology that will... -
RecordSet.Move or RecordSet.AbsolutePosition??
Hi, I'm trying to use either one of these methods to position the cursor in a specific position inside a recordset, but neither one seems to... -
Laphan #2
Bringing a Timestamp into a recordset
Hi Guys
The subject of this post might be misleading, but basically I have created a
basic query ASP page that will allow a user to copy and paste their SQL
query into a textbox so that they can execute it on their SQL DB to bring
back the result.
Now I understand how to dynamically bring back the relevant data cols and
rows, but the only bit that I fall foul on is if the user has done a select
* from a table and brings back a timestamp field.
For some reason when my recordset tries to display this timestamp it blows
up, which is unlike say MS Query that displays the figure.
Is there a special encapsulating command that I have to wrap the recordset
in so that it can handle the displaying of timestamps?
Rgds
Laphan
Laphan Guest
-
Laphan #3
Re: Bringing a Timestamp into a recordset
Not trying to gain anything. Because users may enter 'select * from XXX', I
wanted to format/trap the timestamp so that at least they wouldn't bomb the
page, which is what happens everytime a timestamp is involved in a query.
Rgds
Laphan
Aaron Bertrand - MVP <aaron@TRASHaspfaq.com> wrote in message
news:OZg2EFN9DHA.1672@TK2MSFTNGP12.phx.gbl...
Timestamp isn't really "data" ... it is just a binary rowversion. What are
you trying to gain by displaying it on the page?
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
"Laphan" <news@DoNotEmailMe.co.uk> wrote in message
news:ebOEGDN9DHA.2604@TK2MSFTNGP10.phx.gbl...a> Hi Guys
>
> The subject of this post might be misleading, but basically I have createdselect> basic query ASP page that will allow a user to copy and paste their SQL
> query into a textbox so that they can execute it on their SQL DB to bring
> back the result.
>
> Now I understand how to dynamically bring back the relevant data cols and
> rows, but the only bit that I fall foul on is if the user has done a> * from a table and brings back a timestamp field.
>
> For some reason when my recordset tries to display this timestamp it blows
> up, which is unlike say MS Query that displays the figure.
>
> Is there a special encapsulating command that I have to wrap the recordset
> in so that it can handle the displaying of timestamps?
>
> Rgds
>
> Laphan
>
>
Laphan Guest
-
Chris Hohmann #4
Re: Bringing a Timestamp into a recordset
"Laphan" <news@DoNotEmailMe.co.uk> wrote in message
news:ebOEGDN9DHA.2604@TK2MSFTNGP10.phx.gbl...created a> Hi Guys
>
> The subject of this post might be misleading, but basically I haveSQL> basic query ASP page that will allow a user to copy and paste theirbring> query into a textbox so that they can execute it on their SQL DB toand> back the result.
>
> Now I understand how to dynamically bring back the relevant data colsselect> rows, but the only bit that I fall foul on is if the user has done ablows> * from a table and brings back a timestamp field.
>
> For some reason when my recordset tries to display this timestamp itrecordset> up, which is unlike say MS Query that displays the figure.
>
> Is there a special encapsulating command that I have to wrap theAs Aaron pointed out, rowversion data is stored as binary(8). As such,> in so that it can handle the displaying of timestamps?
you have two options:
1. Test the data type and omit it's display if it is binary data. I
believe rowversion data is delivered as an array of bytes. As such you
would first test to see if the data was an array. Then check if the data
type of the array elements is a byte.
2. To actually display the data you will need to convert the data to a
string of some sort. I would recommend converting the data to a
hexadecimal string representation.
The "howto's" of working with binary data can be found here:
[url]http://www.pstruh.cz/tips/detpg_BinASP.htm[/url]
HTH
-Chris Hohmann
Chris Hohmann Guest
-
Aaron Bertrand [MVP] #5
Re: Bringing a Timestamp into a recordset
> Not trying to gain anything. Because users may enter 'select * from XXX'
No, no, no. Don't EVER let users enter 'SELECT * from ANYTHING. Ever.
Period.
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
Aaron Bertrand [MVP] Guest
-
Astra #6
Re: Bringing a Timestamp into a recordset
Aaron
I understand your comments regarding select *'s, but I would rather trap the
timestamp to make the page more robust than limit the simplicity and
functionality of what I'm trying to achieve with this.
Many thanks to you and Chris for your feedback.
Rgds Robbie
"Chris Hohmann" <nospam@thankyou.com> wrote in message
news:eCa0Nhb9DHA.3880@TK2MSFTNGP11.phx.gbl...
"Laphan" <news@DoNotEmailMe.co.uk> wrote in message
news:ebOEGDN9DHA.2604@TK2MSFTNGP10.phx.gbl...created a> Hi Guys
>
> The subject of this post might be misleading, but basically I haveSQL> basic query ASP page that will allow a user to copy and paste theirbring> query into a textbox so that they can execute it on their SQL DB toand> back the result.
>
> Now I understand how to dynamically bring back the relevant data colsselect> rows, but the only bit that I fall foul on is if the user has done ablows> * from a table and brings back a timestamp field.
>
> For some reason when my recordset tries to display this timestamp itrecordset> up, which is unlike say MS Query that displays the figure.
>
> Is there a special encapsulating command that I have to wrap theAs Aaron pointed out, rowversion data is stored as binary(8). As such,> in so that it can handle the displaying of timestamps?
you have two options:
1. Test the data type and omit it's display if it is binary data. I
believe rowversion data is delivered as an array of bytes. As such you
would first test to see if the data was an array. Then check if the data
type of the array elements is a byte.
2. To actually display the data you will need to convert the data to a
string of some sort. I would recommend converting the data to a
hexadecimal string representation.
The "howto's" of working with binary data can be found here:
[url]http://www.pstruh.cz/tips/detpg_BinASP.htm[/url]
HTH
-Chris Hohmann
Astra Guest
-
Bob Barrows #7
Re: Bringing a Timestamp into a recordset
Astra wrote:
Lazy. You are impacting the performance of your application.> Aaron
>
> I understand your comments regarding select *'s, but I would rather
> trap the timestamp to make the page more robust than limit the
> simplicity and functionality of what I'm trying to achieve with this.
>
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Aaron Bertrand - MVP #8
Re: Bringing a Timestamp into a recordset
> Lazy. You are impacting the performance of your application.
Not to mention security... why should end users know, or even have to know,
the structure of your table(s)?
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
Aaron Bertrand - MVP Guest
-
Laphan #9
Re: Bringing a Timestamp into a recordset
Understood.
Thanks Laphan
Aaron Bertrand - MVP <aaron@TRASHaspfaq.com> wrote in message
news:uiqtcDj9DHA.2608@TK2MSFTNGP10.phx.gbl...Not to mention security... why should end users know, or even have to know,> Lazy. You are impacting the performance of your application.
the structure of your table(s)?
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
Laphan Guest



Reply With Quote

