在 VB 2010 中,我试图在不修改现有 MySQL 表的情况下以 ProperCase 显示 DisplayMember。
我的代码片段如下所示:
Dim sql0 As String = "SELECT business, customer_id FROM customers WHERE cab = '1'"
Dim data0 As New MySqlDataAdapter(sql0, main.conn)
Dim ds0 As New DataSet
ds0.Clear()
data0.Fill(ds0, "customers")
cmb_company.DataSource = ds0
cmb_company.DisplayMember = "customers.business"
cmb_company.ValueMember = "customers.customer_id"
我试过这样的事情:
cmb_company.DisplayMember = StrConv("customers.business_name", VbStrConv.ProperCase)
但这只会改变引号部分的大小写,而不是实际返回的值。我也尝试像这样从 MySQL 查询:
"SELECT UPPER(business), customer_id FROM customers WHERE cab = '1'"
但这无法返回“业务”字段..
如果我的组合框有适当的案例而不改变一切,我会喜欢它。
我很感激任何建议!