vb+sql想调用数据库中某个表的某一列某一行的单个数值
我是这样做的,但是最后只有一个空白的文本框,连接没有问题,就是调这个数不行,帮我看看那里的问题吧PrivateSubForm_Load()'载入窗体后的动作'------...
我是这样做的,但是最后只有一个空白的文本框,连接没有问题,就是调这个数不行,帮我看看那里的问题吧
Private Sub Form_Load() '载入窗体后的动作
'-------------------------------------------
'建立全局性数据连接
Set gconn = New ADODB.Connection
Dim strConn As String
gconn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=PaperMakingSysterm;Data Source=127.0.0.1"
gconn.Open Connection
Dim recNumberofquestion As ADODB.Recordset
Set recNumberofquestion = New ADODB.Recordset
Set recNumberofquestion.ActiveConnection = gconn
recNumberofquestion.Open "select Numberofquestion from tabNumofquestion where Styleofquestion='Fillblank'", gconn, adOpenKeyset, adLockOptimistic
'---------------------------------------'把数据显示与文本框中
Sub View()
txtCheck.Text = recNumberofquestion.Fields
End Sub 展开
Private Sub Form_Load() '载入窗体后的动作
'-------------------------------------------
'建立全局性数据连接
Set gconn = New ADODB.Connection
Dim strConn As String
gconn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=PaperMakingSysterm;Data Source=127.0.0.1"
gconn.Open Connection
Dim recNumberofquestion As ADODB.Recordset
Set recNumberofquestion = New ADODB.Recordset
Set recNumberofquestion.ActiveConnection = gconn
recNumberofquestion.Open "select Numberofquestion from tabNumofquestion where Styleofquestion='Fillblank'", gconn, adOpenKeyset, adLockOptimistic
'---------------------------------------'把数据显示与文本框中
Sub View()
txtCheck.Text = recNumberofquestion.Fields
End Sub 展开
1个回答
2013-06-13
展开全部
txtCheck.Text = recNumberofquestion(0)或txtCheck.Text = recNumberofquestion("字段名")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询