VB.NET如何在listbox中显示数据库的某一字段的内容(ACCESS) 25
比方我要显示表"凭证字"的字段,字段名"凭证字",给代码吧,代码尽量全!从privatesubForm_load到endsub已有代码dimsqlstringasstri...
比方我要显示表"凭证字"的字段,字段名"凭证字",给代码吧,代码尽量全!从private sub Form_load到end sub
已有代码
dim sqlstring as string="select 凭证字 from 凭证字"
Dim connstr as String="Provider=Microsoft.Jet.Oledb.4.0;"& "Data source=rent.mdb
dim gt as new dataTable
dim dataAdapter as new OleDb.OleDbDataAdapter(sqlstring,connStr)
之后如何写代码才能在LISTBOX中显示数据库中凭证字字段的内容 展开
已有代码
dim sqlstring as string="select 凭证字 from 凭证字"
Dim connstr as String="Provider=Microsoft.Jet.Oledb.4.0;"& "Data source=rent.mdb
dim gt as new dataTable
dim dataAdapter as new OleDb.OleDbDataAdapter(sqlstring,connStr)
之后如何写代码才能在LISTBOX中显示数据库中凭证字字段的内容 展开
展开全部
Private Sub frmInput_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dim sqlstring as string="select 凭证字 from 凭证字"
Dim connstr as String="Provider=Microsoft.Jet.Oledb.4.0;"& "Data source=rent.mdb"
Dim ConnTemp As New OleDb.OleDbConnection
Dim RSTemp As OleDb.OleDbDataReader
ConnTemp.ConnectionString = connstr
Dim CmdTemp As New OleDb.OleDbCommand(sqlstring, ConnTemp)
ConnTemp.Open()
RSTemp = CmdTemp.ExecuteReader
Do While RSTemp.Read
ListBox1.Items.Add(RSTemp(0))
Loop
RSTemp.Close()
conntemp.close
dim sqlstring as string="select 凭证字 from 凭证字"
Dim connstr as String="Provider=Microsoft.Jet.Oledb.4.0;"& "Data source=rent.mdb"
Dim ConnTemp As New OleDb.OleDbConnection
Dim RSTemp As OleDb.OleDbDataReader
ConnTemp.ConnectionString = connstr
Dim CmdTemp As New OleDb.OleDbCommand(sqlstring, ConnTemp)
ConnTemp.Open()
RSTemp = CmdTemp.ExecuteReader
Do While RSTemp.Read
ListBox1.Items.Add(RSTemp(0))
Loop
RSTemp.Close()
conntemp.close
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询