请大家帮我看一下这几句VB代码是什么意思

来源:百度知道 编辑:UC知道 时间:2024/05/29 10:57:05
Dim 学号, 课程编号, 成绩 As String
学号 = Text1.Text
课程编号 = Text2.Text
成绩 = Text3.Text
Dim rs As New ADODB.Recordset
Dim txtSQL As String
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.ConnectionTimeout = 25
conn.Provider = "sqloledb"
conn.Properties("datasource").Value = "1B93A478156D44B"
conn.Properties("initial catalog").Value = "xscj"
conn.Properties("integrated security").Value = "sspi"
conn.Properties("user id").Value = "sa"
conn.Open
On Error GoTo errh
If Text1.Text = "" Then
MsgBox "不能为空"
If Text2.Text = "" Then
MsgBox "不能为空"
If Text3.Text = "" Then
MsgBox "不能为空"
End If
End If
End If
txtSQL = "select * from xsb where 学号='" & 学号 & "'"
Set rs = New ADODB.Recordset

最基本的就不说了,其他的一些事关于连接数据库的,我好久没弄了,也只能大概的说下!
Dim 学号, 课程编号, 成绩 As String
学号 = Text1.Text
课程编号 = Text2.Text
成绩 = Text3.Text
Dim rs As New ADODB.Recordset /实例化一个ADO
Dim txtSQL As String
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection /用来连觉数据库的
conn.ConnectionTimeout = 25
conn.Provider = "sqloledb" //用微软提供的OLEDB来连接数据库
conn.Properties("datasource").Value = "1B93A478156D44B" //数据源
conn.Properties("initial catalog").Value = "xscj" /数据库名字
conn.Properties("integrated security").Value = "sspi"
conn.Properties("user id").Value = "sa" /数据库登录名
conn.Open 打开连接数据库
On Error GoTo errh
If Text1.Text = "" Then
MsgBox "不能为空"
If Text2.Text = "" Then
MsgBox "不能为空"
If Text3.Text = "" Then
MsgBox "不能为空"
End If
End If
End If