Did anyone have a small sample C# ASP.NET application that uses MySQL components with a datagrid? The delivered sample application only shows how to display data but not how to edit and update/insert/delete data. Would be nice to have an sample application to easy learn how to use the components.
Thanks.
Sample ASP.NET application
The following is step-by-step scenario on how to configure data components in ASP.NET applications:
1. Having a GridView on the page choose option in the DataSourceID property of this component in the Properties window.
2. In the "Choose a Data Source Type" window of appeared Data Source Configuration Wizard choose Database icon and press OK.
3. Press "New Connection..." button on the "Choose Your Data Connection" window.
4. On the "Add Connection" dialog press "Change..." button and then choose "MySQL Database" option from the list, press OK.
5. Fill in all the fields as appropriate: Host=localhost; Port=3306; User Id=root; Password=root; Database=Demobase. Press OK.
6. Press Next on the "Choose Your Data Connection" window.
7. On the "Save the Connection String to the Application Configuration File" window make modifications you need and press Next.
8. On the "Configure the Select Statement" window choose "Specify columns from a table or view" radio button, choose needed database object from the list and check needed columns. Press "Advanced..." button. On the appeared dialog window tick "Generate Insert, Update, and Delete statement" checkbox and press OK. Press Next.
9. Press Finish on the "Test Query" window.
10. Check "Enable editing" and "Enable deleting" checkboxes for GridView component.
You are done. Now you are able to hit the Start Debugging arrow in Visual Studio and see your GridView filled with data from the database.
1. Having a GridView on the page choose option in the DataSourceID property of this component in the Properties window.
2. In the "Choose a Data Source Type" window of appeared Data Source Configuration Wizard choose Database icon and press OK.
3. Press "New Connection..." button on the "Choose Your Data Connection" window.
4. On the "Add Connection" dialog press "Change..." button and then choose "MySQL Database" option from the list, press OK.
5. Fill in all the fields as appropriate: Host=localhost; Port=3306; User Id=root; Password=root; Database=Demobase. Press OK.
6. Press Next on the "Choose Your Data Connection" window.
7. On the "Save the Connection String to the Application Configuration File" window make modifications you need and press Next.
8. On the "Configure the Select Statement" window choose "Specify columns from a table or view" radio button, choose needed database object from the list and check needed columns. Press "Advanced..." button. On the appeared dialog window tick "Generate Insert, Update, and Delete statement" checkbox and press OK. Press Next.
9. Press Finish on the "Test Query" window.
10. Check "Enable editing" and "Enable deleting" checkboxes for GridView component.
You are done. Now you are able to hit the Start Debugging arrow in Visual Studio and see your GridView filled with data from the database.