我的VB比VC好!呵呵!不好意思,贴了一个!
Public Sub Main()
SeekX
End SubPublic Sub SeekX()
Dim rst As ADODB.Recordset
Dim strID As String
Dim strPrompt As String
strPrompt = "Enter an EmployeeID (e.g., 1 to 9)"Set rst = New ADODB.Recordset
rst.CursorLocation = adUseServer
rst.Open "employees", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\temp\northwind.mdb;" & _
"user id=admin;password=;", _
adOpenKeyset, adLockReadOnly, adCmdTableDirect' Does this provider support Seek and Index?
If rst.Supports(adIndex) And rst.Supports(adSeek) Then
rst.Index = "EmployeeId"
' Display all the employees.
rst.MoveFirst
Do While rst.EOF = False
Debug.Print rst!EmployeeID; ": "; rst!firstname; " "; _
rst!LastName
rst.MoveNext
Loop
' Prompt the user for an EmployeeID between 1 and 9.
rst.MoveFirst
Do
strID = LCase(Trim(InputBox(strPrompt, "Seek Example")))
' Quit if strID is a zero-length string (CANCEL, null, etc.)
If Len(strID) = 0 Then Exit Do
If Len(strID) = 1 And strID >= "1" And strID <= "9" Then
rst.Seek Array(strID), adSeekAfterEQ
If rst.EOF Then
Debug.Print "Employee not found."
Else
Debug.Print strID; ": Employee='"; rst!firstname; " "; _
rst!LastName; "'"
End If
End If
Loop
End Ifrst.Close
End Sub
Public Sub Main()
SeekX
End SubPublic Sub SeekX()
Dim rst As ADODB.Recordset
Dim strID As String
Dim strPrompt As String
strPrompt = "Enter an EmployeeID (e.g., 1 to 9)"Set rst = New ADODB.Recordset
rst.CursorLocation = adUseServer
rst.Open "employees", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\temp\northwind.mdb;" & _
"user id=admin;password=;", _
adOpenKeyset, adLockReadOnly, adCmdTableDirect' Does this provider support Seek and Index?
If rst.Supports(adIndex) And rst.Supports(adSeek) Then
rst.Index = "EmployeeId"
' Display all the employees.
rst.MoveFirst
Do While rst.EOF = False
Debug.Print rst!EmployeeID; ": "; rst!firstname; " "; _
rst!LastName
rst.MoveNext
Loop
' Prompt the user for an EmployeeID between 1 and 9.
rst.MoveFirst
Do
strID = LCase(Trim(InputBox(strPrompt, "Seek Example")))
' Quit if strID is a zero-length string (CANCEL, null, etc.)
If Len(strID) = 0 Then Exit Do
If Len(strID) = 1 And strID >= "1" And strID <= "9" Then
rst.Seek Array(strID), adSeekAfterEQ
If rst.EOF Then
Debug.Print "Employee not found."
Else
Debug.Print strID; ": Employee='"; rst!firstname; " "; _
rst!LastName; "'"
End If
End If
Loop
End Ifrst.Close
End Sub
解决方案 »
- 500元拜师
- activex 安装程序的制作 急!
- 问一个 关于 CDialog::OnInitDialog()问题,请进
- vc+ado+access2000 如何使用索引,求教!!!
- 如何改变Edit文字的字体???
- ×!!怎么在vc中显示正弦波,并周期得采集数据!!
- 请问一下ADO连接数据的问题?
- 很奇怪的问题,困扰已久,希望大家帮忙!!!
- 我在上网时遇到问题:当点击时显示javascript:tomenu(index3.asp)打不开网页,应该怎么办?请指教!!!!!
- Link error(VC)
- 关于com 的问题:我做了个exe com 在一台机器上运行,我要在另一台机器上调用它,应该用哪些函数。
- com基本概念???
说说而已,我不是高手
就查询没做了!你用了SEEK语句!有没有用FIND加RECORDSET做的啊!
VB论坛那边的人说用SQL做!问题是那个玩意我还真的不会呢!
我用VB做了“工资,采购,销售,校园管理”等系统。一定要用VC,非不能也,实在太麻烦!
结论:VC无所不能,VB有所不能。
然后查询就下面一句话:
rs.Open "select 字段 from 表 where 条件", conn,3
多简单呀!
find的速度慢,用起来还更麻烦。找本SQL书看上两个小时就会了
这肯定是有关系的,怎么说呐,结论:VC无所不能,VB有所不能。
vc不管是在开发模式还是在代码效率上都远远的超过了vb。但是也不是说vb就一无是处,如asp.net。
难道VC也能写linux应用程序吗?
难道汇编能够实现的所有功能VC都能实现吗??
管你用什么
vb delphi 等快速开发工具还是很有用的
dim rsc as recordset
rec.openrecordset("select * from table",dbreadonly)
之后字段读取如下
x=rec("字段名")
但我实在不知道怎样用C去写那里的程序(只会用汇编写)。
如果用C真的不能写,直接回答就是了(不过以后我可不想见到什么"VC无所不能"之类的话)。
呵呵
我很久前写过VB的程序,呵呵,不过很久了
/* 我觉得VC比VB简单. ***********************************/由于学VC必须学Windows,COM等内幕技术,所以我想学VC的可能比学VB的更会VB.
不是有意吵架玩吧!一定要用VC写linux应用程序?找找Tributory吧!
如果用c编写启动程序,那么c的启动代码必须重写,未公开的Dos秘密里有完整示例.
之前怎可启动应用程序呢?
不好意思,虽不是本意,我也是其中之一,趁火打劫了一把。