vb.net中怎么把数据库中表的某一列显示在combobox中
我想在combobox1下拉菜单中显示数据库中收费站信息表中的收费站名称列我输入如下代码后倒数第二行错误提示tables[]中应为标识符请问该怎么改????还是代码有错误...
我想在combobox1下拉菜单中显示数据库中收费站信息表中的收费站名称列
我输入如下代码后 倒数第二行错误提示tables[]中应为标识符
请问该怎么改????还是代码有错误???
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim constr As String = "data source=PC201502281351\SQLEXPRESS;initial catalog=高速公路收费系统;integrated security=true"
Dim con As New SqlConnection(constr)
Dim sqlstr As String = "select 收费站名称 from 收费站信息表"
Dim ds1 As New DataSet()
Dim da As New SqlDataAdapter(sqlstr, con)
da.Fill(ds1, "收费站信息表")
ComboBox1.DataSource = ds1.Tables["收费站信息表"]
ComboBox1.DisplayMember = "收费站名称" 展开
我输入如下代码后 倒数第二行错误提示tables[]中应为标识符
请问该怎么改????还是代码有错误???
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim constr As String = "data source=PC201502281351\SQLEXPRESS;initial catalog=高速公路收费系统;integrated security=true"
Dim con As New SqlConnection(constr)
Dim sqlstr As String = "select 收费站名称 from 收费站信息表"
Dim ds1 As New DataSet()
Dim da As New SqlDataAdapter(sqlstr, con)
da.Fill(ds1, "收费站信息表")
ComboBox1.DataSource = ds1.Tables["收费站信息表"]
ComboBox1.DisplayMember = "收费站名称" 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询