Current location: Hot Scripts Forums » Programming Languages » ASP.NET » Set encoding access database


Set encoding access database

Reply
  #1 (permalink)  
Old 09-11-08, 08:10 AM
Wizard4U Wizard4U is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Set encoding access database

Hello everybody from Croatia!
I have database in iso-8859-2, but I need to create xml file in utf-8.
Where and how to put set utf-8 in my code?
Thanks
I do like this in PHP
Code:
db_connect();
	mysql_query("SET NAMES 'UTF8'");
mysql_query("SET character_set_client='UTF8'");
This is my asp.net code for database connection
Code:
'CONNECTION TO DATABASE
			dim dbconn,sql,dbcomm
			dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.MapPath("../baze/test.mdb"))


			dbconn.Open()
			

			sql="SELECT * FROM	nekretnine, tipovinekretnina WHERE nekretnine.idtipnekretnine = tipovinekretnina.idtipnekretnine ORDER BY nekretnine.idnekretnine"
			dbcomm=New OleDbCommand(sql,dbconn)
			dbread=dbcomm.ExecuteReader()
			
			while dbread.Read()
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-16-08, 02:46 AM
Wizard4U Wizard4U is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Nobody know's, or nobody want's to tell me!
Can somebody PLEASE help me!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-16-08, 05:21 AM
omniman's Avatar
omniman omniman is offline
Coding Addict
 
Join Date: Aug 2006
Location: Baltimore, MD
Posts: 342
Thanks: 0
Thanked 1 Time in 1 Post
Presumably you will be using the System.Xml namespace - probably XmlWriter... I think you can set the encoding via that somehow but it is escaping me now.
__________________
"Political Correctness is a doctrine, fostered by a delusionary, illogical, liberal minority and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a turd by the clean end."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 09-16-08, 05:24 AM
Wizard4U Wizard4U is offline
New Member
 
Join Date: Sep 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
I heavent't hear for that method. I know that I must after conncection on access database do encoding from iso-8859-2 to utf-8 and then print or something else.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 09-16-08, 08:52 AM
omniman's Avatar
omniman omniman is offline
Coding Addict
 
Join Date: Aug 2006
Location: Baltimore, MD
Posts: 342
Thanks: 0
Thanked 1 Time in 1 Post
When you initialize the HtmlTextWriter, you can set the encoding there - that will setup the XML properly, then you just iterate your result set and write the nodes.

The following example is just static, but you could easily convert it to iterate your dataset and write dynamically. It's in C# so you may need to convert it but there are plenty of free converters online.

Also, you will probably need to convert it to write to the buffer rather than a file.

aspnet Code:
    using System; using System.IO; using System.Xml; public class Sample {   public static void Main()   {     XmlTextWriter writer = new XmlTextWriter("myMedia.xml", System.Text.Encoding.GetEncoding("utf-8"));     //Use automatic indentation for readability.     writer.Formatting = Formatting.Indented;             //Write the root element     writer.WriteStartElement("items");     //Start an element     writer.WriteStartElement("item");     //Add an attribute to the previously created element     writer.WriteAttributeString("rating", "R");           //add sub-elements     writer.WriteElementString("title", "The Matrix");     writer.WriteElementString("format", "DVD");     //End the item element     writer.WriteEndElement();  // end item       //Write some white space between nodes     writer.WriteWhitespace("\n");     //Write a second element using raw string data     writer.WriteRaw("<item>" +                     "<title>BloodWake</title>" +                     "<format>XBox</format>" +                     "</item>");     //Write a third element with formatting in the string     writer.WriteRaw("\n  <item>\n" +                     "    <title>Unreal Tournament 2003</title>\n" +                     "    <format>CD</format>\n" +                     "  </item>\n");     // end the root element     writer.WriteFullEndElement();                   //Write the XML to file and close the writer     writer.Close();    } }
__________________
"Political Correctness is a doctrine, fostered by a delusionary, illogical, liberal minority and rabidly promoted by an unscrupulous mainstream media, which holds forth the proposition that it is entirely possible to pick up a turd by the clean end."
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OOP C-Sharp DB Access Wrapper Question digioz ASP.NET 1 09-08-08 10:54 AM
Maximum Limits of Microsoft Access Database digioz Database 3 05-14-06 07:59 AM
deploying multiple form application that uses Access database lschafer Windows .NET Programming 5 04-20-06 05:00 PM
ASP upload prob minority ASP 1 06-27-05 09:35 AM
2 questions 1-Webbased database access. 2-PDF data retrieval Mehre PHP 1 04-11-04 05:20 AM


All times are GMT -5. The time now is 07:28 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.