Showing posts with label convert. Show all posts
Showing posts with label convert. Show all posts

Friday, March 23, 2012

How to get the date part of Datetime

Is there any other way which is more simpler(shorter) to get the date
part (I don't want the time part ) of Datetime than this ?

Convert(nvarchar, DATEPART(dd,[Date]) ) + '/' + Convert(nvarchar,
DATEPART(mm,[Date])) + '/' + Convert(nvarchar, DATEPART(yy,[Date])) As
[Date]> Is there any other way which is more simpler(shorter) to get the date
> part (I don't want the time part ) of Datetime than this ?
> Convert(nvarchar, DATEPART(dd,[Date]) ) + '/' + Convert(nvarchar,
> DATEPART(mm,[Date])) + '/' + Convert(nvarchar, DATEPART(yy,[Date])) As
> [Date]

convert(char(10),getdate(),120)
http://www.karaszi.com/SQLServer/info_datetime.asp

Wednesday, March 21, 2012

how to get text (html) from "Render" method

currently i'm getting a stream back and am using [see code at end] to convert
it
what i get back on the screen is a bunch of crap like this
MIME-Version: 1.0 Content-Type: multipart/related;
boundary="--=_NextPart_01C35DB7.4B204430" X-MSSQLRS-ProducerVersion:
V8.00.878.00 This is a multi-part message in MIME format.
--=_NextPart_01C35DB7.4B204430 Content-ID: Content-Disposition: inline;
filename="DASH0014" Content-Type: text/html; name="DASH0014"; charset="utf-8"
Content-Transfer-Encoding: base64
PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEgVHJhbnNpdGlvbmFs
Ly9FTiI+DQo8aHRtbD4NCjxoZWFkPg0KPHRpdGxlPg0KREFTSDAwMTQNCjwvdGl0bGU........................etc
instead of what i was expecting - a nicely formed html doc
is it because i am converting the stream?
is there a better way of handling the stream?
am i using the wrong encoding?
thanks
a.
--CODE START
Dim result As Byte() = Nothing
...
result = rs.Render(Report, Format, HistoryID, DeviceInfo,
Parameters, Credentials, _
ShowHideToggle, Encoding, MIMEType, ParametersUsed, Warnings,
StreamIDs)
Dim star As String
Dim ec As System.Text.Encoding = System.Text.Encoding.UTF8
star = ec.GetString(result)
Message.InnerHtml = star
--CODE ENDok so i set this and it works
Dim Format As String = "HTML4.0"
(it was "MHTML")
but now i have a new problem
"adolf garlic" wrote:
> currently i'm getting a stream back and am using [see code at end] to convert
> it
> what i get back on the screen is a bunch of crap like this
> MIME-Version: 1.0 Content-Type: multipart/related;
> boundary="--=_NextPart_01C35DB7.4B204430" X-MSSQLRS-ProducerVersion:
> V8.00.878.00 This is a multi-part message in MIME format.
> --=_NextPart_01C35DB7.4B204430 Content-ID: Content-Disposition: inline;
> filename="DASH0014" Content-Type: text/html; name="DASH0014"; charset="utf-8"
> Content-Transfer-Encoding: base64
> PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEgVHJhbnNpdGlvbmFs
> Ly9FTiI+DQo8aHRtbD4NCjxoZWFkPg0KPHRpdGxlPg0KREFTSDAwMTQNCjwvdGl0bGU........................etc
> instead of what i was expecting - a nicely formed html doc
> is it because i am converting the stream?
> is there a better way of handling the stream?
> am i using the wrong encoding?
> thanks
> a.
>
> --CODE START
> Dim result As Byte() = Nothing
> ...
> result = rs.Render(Report, Format, HistoryID, DeviceInfo,
> Parameters, Credentials, _
> ShowHideToggle, Encoding, MIMEType, ParametersUsed, Warnings,
> StreamIDs)
> Dim star As String
> Dim ec As System.Text.Encoding = System.Text.Encoding.UTF8
> star = ec.GetString(result)
> Message.InnerHtml = star
> --CODE END
>sql