File: MySqlParameterCollection.xml

package info (click to toggle)
mysql-connector-net 6.4.3-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,160 kB
  • ctags: 8,552
  • sloc: cs: 63,689; xml: 7,505; sql: 345; makefile: 50; ansic: 40
file content (45 lines) | stat: -rw-r--r-- 1,632 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<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="System.Data.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="vbnet">
        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>