用.net mvc框架MySQL数据库做一个datagrid来显示数据怎么写????有源码就最好了
你可以找.net mvc框架使用sql server数据库做datagrid的例子,很好找。然后下载ef for mysql provider,替换掉默认的sql server provider,并且修改连接字符串,即可得到你的程序。
tring ConnStr = System.Configuration.ConfigurationSettings.AppSettings["ConnectionSqlServer"];
SqlConnection hubingconn = new SqlConnection(ConnStr);
SqlDataAdapter hubingda = new SqlDataAdapter("select employeeid,lastname,firstname from employees",hubingconn);
DataSet hubingds = new DataSet();
try
{
hubingda.Fill(hubingds,"testTable");
DataGrid1.DataSource=hubingds;
DataGrid1.DataBind();
}
catch(Exception error)
{
Response.Write(error.ToString());
}
http://blog.csdn.net/colin915gao/article/details/1574588
http://www.codesocang.com/jiaocheng/_netjiaocheng/2014/0314/6990.html
一个是用SQL server来做的,一个是用C#来做的,感觉用不上