我目前正在VB.Net中使用SQL后端在Visual Studio中构建一些自定义软件。我有一个用户在comboBox中选择的帐户名列表。使用DataReader方法从Accounts Table的“Name”列中通过SQL查询填充comboBox,如下所示:
Dim Connection As New SqlConnection(connectionString:=<Blah>")
Dim cmd1 As New SqlCommand(
"SELECT Name from Accounts as A", Connection
)
Connection.Open()
Dim rs1 As SqlDataReader = cmd1.ExecuteReader
Dim dt1 As DataTable = New DataTable
dt1.Load(rs1)
AccountComboBoxDropdown.ValueMember = "Name"
AccountComboBoxDropdown.DisplayMember = "Name"
我的帐户表还有一个名为“类型”的列,我想用它来定义图片(每个图片文件将驻留在项目文件夹中,其名称与类型列相同,即cash.png,Revolving.png。 ..等)每个帐户类型:
Accounts Table
----------------------------
Name Type
----------------------------
Cash Account 1 Cash
Credit Card 1 Revolving
Mortgage 1 Mortgage
Car Loan 1 Vehicle
左边的图像是我现在的图像,我的目标是得到像右边图像的东西:
是否可以使用数据阅读器?
先谢谢;