日期:2014-05-17 浏览次数:20749 次
private MySqlConnection HaomaConnection;
private MySqlCommand HaomaCommand;
HaomaConnection = new MySqlConnection(HMSTRING);
HaomaConnection.Open();
HaomaCommand = HaomaConnection.CreateCommand();
try
{
HaomaCommand.CommandText = "SELECT * FROM projects";
MySqlDataAdapter adap = new MySqlDataAdapter(HaomaCommand);
DataSet ds = new DataSet();
adap.Fill(ds);
dg_data.LoadingRow += new EventHandler<DataGridRowEventArgs>(dg_data_LoadingRow);
dg_data.ItemsSource = ds.Tables[0].DefaultView;
//lv_data.DataContext = ds.Tables[0].DefaultView;
}
catch (System.Exception ex)
{
MessageBox.Show(ex.ToString());
}
两个问题:
1.怎么将列名改成中文(不在数据库中更改),如把Company改成公司名称,Password改成密码;
2.如何实现删除及打印选中列(如何获取到选中的句柄?);
3.如何控制显示条目行数,增加翻页功能。