<html dir="LTR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
<title>MySqlDataLoader Class</title>
<xml>
</xml>
<link rel="stylesheet" type="text/css" href="MSDN.css" />
</head>
<body id="bodyID" class="dtBODY">
<div id="nsbanner">
<div id="bannerrow1">
<table class="bannerparthead" cellspacing="0">
<tr id="hdr">
<td class="runninghead">DataLoader Documentation</td>
<td class="product">
</td>
</tr>
</table>
</div>
<div id="TitleRow">
<h1 class="dtH1">MySqlDataLoader Class</h1>
</div>
</div>
<div id="nstext">
<p> Data loader implementing <a href="Bttlxe.Data.IDataLoader.html">IDataLoader</a> to access data in a MySQL database. <seealso cref="T:Bttlxe.Data.IDataLoader"></seealso></p>
<p>For a list of all members of this type, see <a href="Bttlxe.Data.MySqlDataLoaderMembers.html">MySqlDataLoader Members</a>.</p>
<p>
<a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemObjectClassTopic.htm">System.Object</a>
<br />���<b>MySqlDataLoader</b></p>
<div class="syntax">
<span class="lang">[Visual�Basic]</span>
<br />Public�Class�MySqlDataLoader<div>Implements�, </div></div>
<div class="syntax">
<span class="lang">[C#]</span>
<div>public�class�MySqlDataLoader<b> : <a href="Bttlxe.Data.IDataLoader.html">IDataLoader</a>, <a href="ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfSystemIDisposableClassTopic.htm">IDisposable</a></b></div>
</div>
<H4 class="dtH4">Thread Safety</H4>
<P>Public static (Shared in Visual Basic) members of this type are
safe for multithreaded operations. Instance members are <b>not</b> guaranteed to be
thread-safe.</P>
<h4 class="dtH4">Remarks</h4>
<p> Uses SQL as the query language. </p>
<h4 class="dtH4">Example</h4>
<p>
<p>The example below demonstrates using a <b>MySqlDataLoader</b> to load data into a <b>NewsList</b> collection which implements <a href="Bttlxe.Data.IDataItem.html">IDataItem</a>. (Note that the definition of the <a href="Bttlxe.Data.DataItemDictionary.html">DataItemDictionary</a> is only needed where name transformation needs to occur, but is shown here for completeness.)</p>
<p class="lang">[C#]</p>
<pre class="code">Bttlxe.Controls.NewsList oNewsList = new Bttlxe.Controls.NewsList();
MySqlDataLoader oLoader = new MySqlDataLoader();
oLoader.Server = "(local)";
oLoader.Database = "tempdb";
DataItemDictionary keys = new DataItemDictionary();
keys.Add("ID", "n_id");
keys.Add("Title", "n_title");
keys.Add("Description", "n_description");
keys.Add("Owner", "n_owner");
keys.Add("Created", "n_created");
IDataItem oItem = (IDataItem)oNewsList;
oLoader.Execute(ref oItem, ref keys, DataOperation.Read);
</pre>
<p>The example below accomplishes the same result as above but without using an <b>IDataItem</b> object.</p>
<p class="lang">[C#]</p>
<pre class="code">MySqlDataLoader oLoader = new MySqlDataLoader();
oLoader.Server = "(local)";
oLoader.Database = "tempdb";
Bttlxe.Controls.NewsList oNewsList = new Bttlxe.Controls.NewsList();
oNewsList.DataSource = oLoader.ExecuteDataTable("SELECT * FROM [News]");
oNewsList.DataBind();
</pre>
<p>The example below demonstrates using a <a href="Bttlxe.Data.DataItem.html">DataItem</a> object to write data to your data source.</p>
<p class="lang">[C#]</p>
<pre class="code">MySqlDataLoader oLoader = new MySqlDataLoader();
oLoader.Server = "(local)";
oLoader.Database = "tempdb";
DataTable dt = new DataTable("News");
dt.Columns.Add("ID", System.Type.GetType("System.Int32"));
dt.Columns.Add("Title", System.Type.GetType("System.String"));
dt.Columns.Add("Description", System.Type.GetType("System.String"));
dt.Columns.Add("Owner", System.Type.GetType("System.String"));
dt.Columns.Add("Created", System.Type.GetType("System.DateTime"));
dt.Columns["ID"].AllowDBNull = false;
dt.Columns["ID"].AutoIncrement = true;
dt.Columns["ID"].AutoIncrementSeed = 1;
dt.Columns["ID"].AutoIncrementStep = 1;
dt.Columns["ID"].ReadOnly = true;
dt.PrimaryKey = new DataColumn[]{dt.Columns["ID"]};
dt.Columns["Title"].AllowDBNull = false;
dt.Columns["Title"].MaxLength = 50;
dt.Columns["Owner"].AllowDBNull = false;
dt.Columns["Owner"].MaxLength = 50;
dt.Columns["Owner"].DefaultValue = "Anonymous";
dt.Columns["Created"].AllowDBNull = false;
DataItemDictionary keys = new DataItemDictionary();
keys.Add("ID", "n_id");
keys.Add("Title", "n_title");
keys.Add("Description", "n_description");
keys.Add("Owner", "n_owner");
keys.Add("Created", "n_created");
DataItem oDataItem = new DataItem();
oDataItem.Data = dt;
oDataItem.Keys = keys;
// perform some operation that adds data to the DataItem.
...
oLoader.Execute(ref oDataItem, DataOperation.Write);
</pre>
</p>
<h4 class="dtH4">Requirements</h4>
<p>
<b>Namespace: </b>
<a href="Bttlxe.Data.html">Bttlxe.Data</a>
</p>
<p>
<b>Assembly: </b>Bttlxe.Data (in Bttlxe.Data.dll)
</p>
<h4 class="dtH4">See Also</h4>
<p>
<a href="Bttlxe.Data.MySqlDataLoaderMembers.html">MySqlDataLoader Members</a> | <a href="Bttlxe.Data.html">Bttlxe.Data Namespace</a> | <a href="Bttlxe.Data.IDataLoader.html">IDataLoader</a></p>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;">
<param name="Keyword" value="MySqlDataLoader class, about MySqlDataLoader class">
</param>
</object>
<hr />
<div id="footer">
<p>
<a href="mailto:dwulff@bttlxe.com?subject=DataLoader%20Documentation%20Documentation%20Feedback:%20MySqlDataLoader%20Class">Send comments on this topic.</a>
</p>
<p>
<a href="http://www.bttlxe.com">Copyright 2004 Battleaxe Software Ltd.</a>
</p>
<p>
</p>
</div>
</div>
</body>
</html>