-2
美好的一天,Datagridcombo框不填充
我有一個程序,從數據庫中提取數據。我正在使用WPF和MVVM。我非常新的這個(但有限的VBA經驗)。該程序正確顯示正確的數據,但我試圖改變一個字段「優先級」,所以當你點擊它時,有一個組合框,我可以從列表中選擇一個新的值,然後將更新數據庫。
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding ProgramID}" Header="Program ID" Width="100" />
<DataGridTextColumn Binding="{Binding Cedant}" Header="Cedant" Width="300" />
<DataGridTextColumn Binding="{Binding UWCode}" Header="Underwriter" Width="145"/>
<DataGridTextColumn Binding="{Binding DateSubmitted}" Header="Date Submitted" Width="145"/>
<DataGridTextColumn Binding="{Binding RequiredDate}" Header="Required Date" Width="145"/>
<DataGridComboBoxColumn Width="100" SelectedValueBinding="{Binding Priority}" ItemsSource="{Binding Priority}" SelectedValuePath="Priority" Header="Priority" DisplayMemberPath="Priority" />
<DataGridTextColumn Binding="{Binding Status}" Header="Status" Width="145"/>
<DataGridTextColumn Binding="{Binding AssignedTo}" Header="Assigned To" Width="125"/>
<DataGridTextColumn Binding="{Binding EffectiveDate}" Header="ResponseDate" Width="145"/>
<DataGridTextColumn Binding="{Binding Modeler}" Header="Modeller" Width="125"/>
</DataGrid.Columns>
你可以看到它的中間條目,我試圖搞砸了。如果我把它作爲datagridtextcolumn它工作得很好。上述
namespace DataModel.Model
{
public class ModelRequest
{
[Key, Column(Order = 1), StringLength(255)]
public int ProgramID { get; set; }
[StringLength(255)]
public string Cedant { get; set; }
[StringLength(255)]
public string UWCode { get; set; }
[StringLength(255)]
public DateTime DateSubmitted { get; set; }
[StringLength(255)]
public DateTime RequiredDate { get; set; }
[StringLength(255)]
public string Priority { get; set; }
[StringLength(255)]
public string Status { get; set; }
[StringLength(255)]
public string AssignedTo { get; set; }
[StringLength(255)]
public DateTime EffectiveDate { get; set; }
[StringLength(255)]
public string Modeler { get; set; }
[StringLength(255)]
public string Prod_Office { get; set; }
}
}
是我的模型
不知道你需要看到什麼。
我的問題是,一個)我如何得到這個組合框首先顯示的數據像它那樣,然後如何添加值選項
二)我怎麼然後鏈接這些值的選項更新數據庫? 運行ssql是
sSQL = "update tbl_ModelRequest " & _
"Set priorityID=" & Priority & " " & _
"where programid=" & ProgramID
請修復您的標籤.. – MethodMan