谁能提供access数据库SQL查询的相关教学视频、急需,谢谢了!

最好是结合试题的视频... 最好是结合试题的视频 展开
 我来答
fctas08
2010-11-27 · TA获得超过428个赞
知道小有建树答主
回答量:459
采纳率:0%
帮助的人:345万
展开全部
我做的一个用来登记银行卡号的系统,实用简单型的,ADO链接数据库,时间也很赶,我觉得刚好合适,改了一下,LZ看看:

登记银行卡号系统.vbp:

Type=Exe
Form=登记银行卡号系统.frm
Reference=*\G#2.0#0#C:\windows\system32\stdole2.tlb#OLE Automation
Object=#1.2#0; comdlg32.ocx
Object=#2.0#0; mscomctl.ocx
IconForm="Form1"
Startup="Form1"
HelpFile=""
Title="登记银行卡号系统"
ExeName32="登记银行卡号系统.exe"
Command32=""
Name="登记银行卡号系统"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="微软中国"
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MS Transaction Server]
AutoRefresh=1

登记银行卡号系统.frm:

VERSION 5.00
Object = "#1.2#0"; "comdlg32.ocx"
Object = "#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1
BorderStyle = 4 'Fixed ToolWindow
Caption = "登记银行卡号系统"
ClientHeight = 6555
ClientLeft = 3135
ClientTop = 2385
ClientWidth = 11535
Icon = "登记银行卡号系统.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6555
ScaleWidth = 11535
ShowInTaskbar = 0 'False
Begin VB.ComboBox Combo1
Height = 300
ItemData = "登记银行卡号系统.frx":0A02
Left = 7350
List = "登记银行卡号系统.frx":0A27
TabIndex = 5
Text = "中国工商银行 "
Top = 210
Width = 1695
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1
Left = 5100
Top = 4290
End
Begin VB.CommandButton Command3
Caption = "导出Excel"
Height = 465
Left = 9900
TabIndex = 14
Top = 210
Width = 1305
End
Begin MSComctlLib.ProgressBar Pro
Height = 345
Left = 450
TabIndex = 13
Top = 3120
Visible = 0 'False
Width = 10365
_ExtentX = 18283
_ExtentY = 609
_Version = 393216
Appearance = 1
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 5970
Top = 4260
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.TextBox Text5
Height = 270
Left = 1050
TabIndex = 2
Text = "请输入确认ID"
Top = 720
Width = 1905
End
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 5100
Left = 2790
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 9
Top = 1290
Width = 8655
End
Begin VB.CommandButton Command2
Caption = "重输"
Height = 315
Left = 8640
TabIndex = 7
Top = 780
Width = 1065
End
Begin VB.CommandButton Command1
Caption = "输入"
Height = 315
Left = 7320
TabIndex = 6
Top = 765
Width = 1065
End
Begin VB.TextBox Text3
Height = 270
Left = 5070
TabIndex = 4
Text = "请输入确认银行卡号"
Top = 780
Width = 1905
End
Begin VB.TextBox Text2
Height = 270
Left = 5040
TabIndex = 3
Text = "请输入银行卡号"
Top = 210
Width = 1905
End
Begin VB.ListBox List1
Height = 5100
ItemData = "登记银行卡号系统.frx":0AB1
Left = 180
List = "登记银行卡号系统.frx":0AB3
TabIndex = 8
Top = 1290
Width = 2415
End
Begin VB.TextBox Text1
Height = 270
Left = 1050
TabIndex = 1
Text = "请输入ID"
Top = 210
Width = 1905
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "ID"
Height = 180
Left = 180
TabIndex = 12
Top = 735
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "确认银行卡号"
Height = 180
Left = 3900
TabIndex = 11
Top = 795
Width = 1080
End
Begin VB.Label YHKH
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "银行卡号"
Height = 180
Left = 4200
TabIndex = 10
Top = 225
Width = 720
End
Begin VB.Label XH
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "ID"
Height = 180
Left = 180
TabIndex = 0
Top = 225
Width = 180
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim conn, rs, Application, WorkBook, Sheet, i As Integer, j As Integer
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const INVALID_HANDLE_VALUE = -1
Private Const LB_FINDSTRING = &H18F

Dim selectIndex As Long

Private Sub Command1_Click()
If Text5 <> "" And Text5 <> Text1 Then
MsgBox "输入学号不一致"
ElseIf Text3 = "" Or Text3 <> Text2 Then
MsgBox "输入银行卡号不一致"
ElseIf List1.ListIndex = -1 Then
MsgBox "没有该记录,请确认该学号 "
ElseIf Len(Combo1.Text) > 25 Then
MsgBox "银行输入超长"
Else
If InStr(rs("id"), Trim(Text1)) > 0 Then
rs("user_yhkh") = Text3
rs("user_yh") = Combo1.Text
rs.Update
MsgBox "保存成功"
Else
rs.Close
rs.open "select * from [TrainAttendant] where id='" & Trim(Text1) & "'", conn, 1, 3
If Not rs.EOF Then
rs("user_yhkh") = Text3
rs("user_yh") = Combo1.Text
rs.Update
MsgBox "保存成功"
Else
MsgBox "未知错误"
End If
rs.Close
rs.open "select * from [TrainAttendant] order by id asc", conn, 1, 3
selectIndex = 0
End If
End If
End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text5 = ""

End Sub

Private Sub Command3_Click()
CommonDialog1.Filter = "EXCEL文件|*.xls"
CommonDialog1.ShowSave
If CommonDialog1.FileName = "" Then
Exit Sub
End If
Form1.Enabled = False
Set Application = CreateObject("Excel.Application") '建立EXCEL对象
Set WorkBook = Application.Workbooks.Add() '建立一个新的Excel文档
Set Sheet = WorkBook.Sheets(1) '选择sheet1
i = 0
rs.Close
rs.open "select * from [TrainAttendant] where len(trim(user_yhkh))>0 order by id asc", conn, 1, 3
For i = 0 To rs.fields.Count - 2
Sheet.Cells(1, i + 1).Value = changeName(rs.fields(i).Name)
Next
Pro.Value = 0
Pro.Visible = True
rs.movefirst
i = 1
j = 1
If Not rs.EOF Then
Pro.Max = rs.recordcount
Pro.Value = 1
End If
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
selectIndex = 0
Set conn = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
conn.open "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\qinguanlieche"
rs.open "select * from [TrainAttendant] order by id asc", conn, 1, 3
Do While Not rs.EOF
List1.AddItem (rs("id"))
rs.movenext
Loop
rs.movefirst
End Sub

Private Sub Form_Unload(Cancel As Integer)
rs.Close
conn.Close
Set conn = Nothing
End Sub

Private Sub List1_Click()
If List1.ListIndex <> -1 Then
rs.Move List1.ListIndex - selectIndex, 0
selectIndex = List1.ListIndex
If Not (rs.EOF Or rs.bof Or List1.ListIndex = -1) Then
Dim i As Integer: i = 0
Text4 = ""
For i = 0 To rs.fields.Count - 2
Text4 = Text4 & changeName(rs.fields(i).Name) & " " & changeName2(rs.fields(i).Name, rs.fields(i).Value) & vbCrLf
Next
End If
Else
Text4 = "没有可用记录"
End If
End Sub

Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command1_Click
End If
End Sub
Private Sub text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo1.SetFocus
End If
End Sub

Private Sub Text5_GotFocus()
Text5.SelStart = 0
Text5.SelLength = Len(Text5)
End Sub

Private Sub Text2_GotFocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2)
End Sub

Private Sub Text1_Change()
List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRING, INVALID_HANDLE_VALUE, ByVal CStr(Text1.Text))
End Sub

Private Sub Text3_GotFocus()
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
End Sub

Private Function changeName(str)
Select Case str
Case "ID": changeName = "ID"
Case "user_Yhkh": changeName = "银行卡号"
Case "user_Yh": changeName = "银行"
End Select
End Function

Private Function changeName2(str1, str2)
Select Case str1
case "id": changeName2 = str2
Case Else: changeName2 = str2
End Select
End Function

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub Timer1_Timer()
If rs.EOF Then
WorkBook.saveas CommonDialog1.FileName
Timer1.Enabled = False
Pro.Visible = False
' Sheet.quit
' WorkBook.quit
Application.quit
Set Application = Nothing
Set WorkBook = Nothing
Set Sheet = Nothing
MsgBox "导出成功"
Form1.Enabled = True
rs.Close
rs.open "select * from [TrainAttendant] order by id asc", conn, 1, 3
selectIndex = 0
Else
Pro.Value = j
j = j + 1
For i = 0 To rs.fields.Count - 2
Sheet.Cells(j, i + 1).NumberFormatLocal = "@"
Sheet.Cells(j, i + 1).Value = CStr(changeName2(rs.fields(i).Name, rs.fields(i).Value) & " ")
Next
rs.movenext
End If
End Sub

Access数据库 qinguanlieche 数据表 TrainAttendant :
ID 自动编号
user_Yhkh 文本 25
user_Yh 文本 25

数据表我改过,楼主可以自己添加字段试试
刚刚测试过,没问题
用VB6.0打开调试会提示错误,但可以调试,主要是因为有个一非文本文件数据获取不到
楼主还有不明白的HI我吧
万山数据
2024-11-14 广告
数据仓库处理是北京万山数据科技有限公司的核心业务之一。我们专注于高效、安全地处理大规模数据,通过先进的数据仓库技术,实现数据的集成、存储、管理和分析。我们的数据仓库解决方案能够支持复杂的数据查询和分析需求,提供实时的数据洞察,助力企业做出更... 点击进入详情页
本回答由万山数据提供
ttfei221
2010-11-25
知道答主
回答量:29
采纳率:0%
帮助的人:17.7万
展开全部
http://you.video.sina.com.cn/a/1812361-1366284200.html
这个可以 我就是在看这个 姜久雨计算机视频教程

参考资料: 姜久雨计算机视频教程

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式