public DataTable FillDataGrid()
{
string CmdString = string.Empty;
using (SqlCeConnection con = new SqlCeConnection(ConString))
{
CmdString = "SELECT categories.categories_id as ID, categories_description.categories_name as name,categories.categories_image as Image,categories.parent_id as parentId,categories.sort_order as sortOrder,categories.date_added as dateAdded,categories.last_modified as lastModified FROM categories INNER JOIN categories_description ON categories.categories_id=categories_description.categories_id where categories_description.language_id=1";
SqlCeCommand cmd = new SqlCeCommand(CmdString, con);
DataTable dt = new DataTable("categories");
SqlCeDataAdapter adapter = new SqlCeDataAdapter(cmd);
adapter.Fill(dt);
return dt;
}
}
public void FillDataGrid()
{
DatabaseCore db = new DatabaseCore();
DataTable dt = db.FillDataGrid();
show_query.ItemsSource = dt.DefaultView;
}
我正在使用 sqlserverCe 作为数据库和 Visual Studio 2012(Windows 演示文稿表单)
我正在使用两个表来填充数据网格视图,并且它工作正常。
我需要从我搜索过的 datagridview 更新数据库,但没有为我的问题找到合适的解决方案.. 单表更新的大部分搜索结果
我使用了 SqlCeCommandBuilder 但它给出了错误,它不适用于基于多个的表,建议我这样做