大家帮我看看这个程序,谢谢了!
日期:2006-11-27 荐:
大家帮我看看这个程序,谢谢了!Option ExplicitDim cn As New adodb.ConnectionDim rs As New adodb.RecordsetDim cm As New adodb.CommandPrivate Sub Form_Load()cn.Provider = "microsoft.jet.oledb.4.0"cn.ConnectionString = "data source=E:\毕业设计\VB Program\serve\hc.mdb"cn.Openrs.LockType = adLockOptimisticrs.CursorType = adOpenKeysetSet rs.ActiveConnection = cnrs.Open "select * from b1"Set .DataSource = rs.DataField = "ID"Set .DataSource = rs.DataField = "date"Set Text3.DataSource = rsText3.DataField = "time"Set Text4.DataSource = rsText4.DataField = "sv"Set Text5.DataSource = rsText5.DataField = "pv"Set Text6.DataSource = rsText6.DataField = "al"If Text6.Text = "1" ThenText6.Text = "是"ElseText6.Text = "否"End IfEnd Sub上半部分用ADO语句连接了一个ACCESS数据库,调试后可以正常显示Private Sub Command4_Click()If Not rs.EOF Thenrs.MoveNextElsers.MovePreviousEnd IfEnd Sub这半部分希望遍历这个数据库,就是利用点击按钮,显示第二条记录,可是总提示错误实时错误‘-2147217842(80040e4e)'究竟是为什么啊,希望高手给个解答引用microsoft ActiveX Data Objects 2.X Library 没有?我调试没有问题啊就是少了下面这些代码可以显示下一条记录If Text6.Text = "1" ThenText6.Text = "是"ElseText6.Text = "否"End If你al字段是逻辑型吗?恩,是有这个问题,删了这段代码就可一了啊al代表是否报警,在ACCESS中直接写的,没设类型,应该怎么弄呢
标签: