List:MySQL and .NET« Previous MessageNext Message »
From:Jure ┼ápik Date:November 21 2004 8:49pm
Subject:Re: Downloading data from a mySql database using vb.net
View as plain text  
I need to download data from a mysql database on the web, using vb.net.
> Could you tell me how to do it, as I cant find any documentation about 
----

You probably won't mind this code is in JScript.NET, insetead of VB.NET

It creates a XmlDataDocument, loads in it data from DataSet, saves to a 
XML file...

I have to use the iso8859_unicode function though, as unicode gets 
corrupted somewhere inbetween... You may not need it.

var MyConString  = "Data Source=" + DataSource + ";Database=" + Database 
+ ";User ID=" + UserID + ";Password=" + Password;
var mycon = new MySqlConnection(MyConString);
var query = "SELECT * FROM TableName;"

var ds: DataSet = new DataSet();
var adapter : MySqlDataAdapter = new MySqlDataAdapter();
adapter.SelectCommand = new MySqlCommand(query, mycon);
adapter.Fill(ds);

var datadoc = new System.Xml.XmlDataDocument(ds);
var d = new System.Xml.XmlDocument();
d.LoadXml(datadoc.OuterXml);
d.InnerXml = iso8859_unicode(d.InnerXml);
d.Save("D:/***/dbbkp.xml")
adapter.Dispose();
mycon.Dispose();
mycon = null;


Thread
Downloading data from a mySql database using vb.netOle Nielsen9 Nov
Re: Downloading data from a mySql database using vb.netSGreen9 Nov
Re: Downloading data from a mySql database using vb.netJure ┼ápik21 Nov