469,602 Members | 1,845 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Dataset.WriteXML and Thread.CurrentThread.CurrentCulture

Hi

I am trying to write data back to the client using dataset.WriteXML and I
have set the Thread.CurrentThread.CurrentCulture to "no" (norwegian) just
before writing the data using WriteXML.
But dataset.WriteXML dosent seems to be using the CurrentCulture settings
and still writes dates, numeric values using the original settings.

My Code...

'Get the standard request/response objects from the current request
context
objHTTPRequest = context.Request
objHTTPResponse = context.Response
'Set the Thread-culture
Try
If objHTTPRequest.UserLanguages.Length > 0 Then
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture(objHTTPRequest.U serLanguages(0))
End If
Catch ex As Exception
'Do nothing if CreateSpecificCulture fails
End Try

'Get the dataset
BuildDataSet(dsDataSet, objSQLParameters, strSPName, strConn,
intParameterCount)

'Start writing back the response as an XML
With objHTTPResponse
.ContentType = "text/xml"
dsDataSet.WriteXml(.OutputStream)
End With

Please advice.

Thanks
rahul


Nov 11 '05 #1
1 2173
Rahul Agarwal wrote:
I am trying to write data back to the client using dataset.WriteXML and I
have set the Thread.CurrentThread.CurrentCulture to "no" (norwegian) just
before writing the data using WriteXML.
But dataset.WriteXML dosent seems to be using the CurrentCulture settings
and still writes dates, numeric values using the original settings.


Well, XML is usually culture-agnostic beast, it's pure data and if you need to
style it somehow (e.g. format dates and currency values) consider using XSLT
or another tool.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Andrés Giraldo | last post: by
4 posts views Thread by Eric | last post: by
3 posts views Thread by MAG | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.