有关vb数据库

来源:百度知道 编辑:UC知道 时间:2024/06/17 09:28:58
本人编一个小软件,需要用数据库保存一些数据。
如何用VB建立一个数据库,向里面导入数据,然后将数据库你的数据全部显示出来?
帮帮忙,我初学者……
打错了一个字……数据库里(你)的数据

可以用VB新生成一个数据库吗?

Dim i, j, s2 As Integer
Dim con As New ADODB.Connection
Dim c, cc, s1 As String

Private Sub Command5_Click()
End
End Sub

Private Sub DataGrid1_Click()
If Adodc1.Recordset.RecordCount > 0 Then
For j = 0 To 5
Text1(j).Text = Adodc1.Recordset.Fields(j)
Next j
End If
End Sub
Private Sub Form_Load()
s1 = "人" + "员表"
Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Password=2752;Persist Security Info=True;User ID=sa;Initial Catalog=sample;Data Source=JAMLEEPC"
Adodc1.RecordSource = "select 编号,姓名,年龄, 学历,年级,入学时间 from " & s1 & " order by '编号'"
Adodc1.Refresh
Form1.Show
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "无人员记录", vbOKOnly, "提示信息"
Else
Set DataGrid1.DataSource = Adodc1
End If
Text1(0).SetFocus

End Sub
Private Sub Command1_Click()
For i = 0 To 5