Hi kevinf,
Please refer the sample.
Database
I have made use of the following table Customers with the schema as follows.
I have already inserted few records in the table.
You can download the database table SQL by clicking the download link below.
Download SQL file
Download and Install the MySQL Connector
You will need to download and install the MySQLConnector in order to connect to the MySQL database in ASP.Net.
Download MySQL Connector
After installation is complete you need to open Windows Explorer and look for the MySql installation in the Program Files folder of your Windows drive.
There you will find a folder for MySQL Connector and inside that you will find the MySql.Data.dll which you need to copy inside the BIN folder of your project.
MySql Connection String
You need to set the MySql Database connection string in the web.config.
<connectionStrings>
<add name="constr" connectionString="Data Source=localhost;port=3306;Initial Catalog=AjaxSamples;User Id=mudassar;password=pass@123" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
Following setting needs to be add in the web.config file.
<system.data>
<DbProviderFactories>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory,MySql.Data" />
</DbProviderFactories>
</system.data>
HTML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" DataSourceID="sdsCustomers">
<Columns>
<asp:BoundField DataField="CustomerId" HeaderText="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Country" HeaderText="Country" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="sdsCustomers" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>"
ProviderName="<%$ ConnectionStrings:constr.providerName%>" SelectCommand="SELECT * FROM Customers"></asp:SqlDataSource>
Screenshot