DataGrid with MySQL Datasource
Hello,
I am evaluating sitefinity and am wondering if someone could let me know how to use a MySQL database as the datasource for controls on my test site. I have not been able to find anything that tells a user, step-by-step, how to get this working properly. I have tried several things to get this to work but to no avail.
If someone could help with this is would be much appreciated.
Thanks,
John
Hello John,
Thank you for using our services.
This can be done in Sitefinity 4.0, but can be used for custom controls at this time. You can create a user control which uses an SqlDataSource control to connect to your database and pull data from it. I have a small screen cast showing the process of creating this data source using it on a Sitefinity 4.0 site. Bellow is the generated markup:
<
asp:GridView
runat
=
"server"
ID
=
"GridView1"
DataSourceID
=
"MySQLData"
></
asp:GridView
>
<
asp:SqlDataSource
runat
=
"server"
ID
=
"MySQLData"
ConnectionString
=
"server=127.0.0.1;User Id=xxxx;password=xxxx;database=mysitefinitydb"
ProviderName
=
"MySql.Data.MySqlClient"
SelectCommand
=
"SELECT * FROM `mysitefinitydb`.`sf_cmscontentbase`;"
></
asp:SqlDataSource
>
Hello Radoslav Georgiev,
Great post - Thanks for the same.
I like to get the same for Vb.Net (windows application)
I mean GridView is very easy with MSSql.
but its not much easy with MySQL (compared with MSSQL)
Do you have any sample code (windows application as well as web application)
for handling GridView ?
hi Thiru
here is some sample of vb.net datagrid view connecting to database
http://vb.net-informations.com/datagridview/vb.net_datagridview_database.htm
from the above form you can add/edit/load from database to datagridview
robert.