Click here to Skip to main content
15,885,780 members
Articles / Database Development / MySQL

MySqlUtil - TableAdapters for MySql

Rate me:
Please Sign up or sign in to vote.
4.59/5 (7 votes)
3 Aug 20063 min read 69.2K   2.1K   47  
A program which generates Typed DataSets and TableAdapters for MySQL databases
<MyDocs>
<MyMembers name="Class">
<remarks>
	The number of the parameters in the collection must be equal to the number of 
parameter placeholders within the command text, or an exception will be generated.
</remarks>

<example>
	The following example creates multiple instances of <see cref="MySqlParameter"/> 
	through the <B>MySqlParameterCollection</B> collection within the <see cref="MySqlDataAdapter"/>.  
	These parameters are used to select data within the data source and place the data in 
	the <see cref="DataSet"/>. This code assumes that a <B>DataSet</B> and a <B>MySqlDataAdapter</B> 
	have already been created with the appropriate schema, commands, and connection.
<code lang="Visual Basic">
Public Sub AddParameters()
    ' ...
    ' create myDataSet and myDataAdapter
    ' ...
    myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"
    myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239
    
    myDataAdapter.Fill(myDataSet)
End Sub 'AddSqlParameters 
	</code>
	<code lang="C#">
public void AddSqlParameters() 
{
// ...
// create myDataSet and myDataAdapter
// ...

  myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters";
  myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239;
  myDataAdapter.Fill(myDataSet);

}
	</code>
</example>


</MyMembers>



</MyDocs>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here



Comments and Discussions