您看看哪错了,多谢
您看看哪错了,谢谢
呵呵,您别笑话,自学,还是第一次。
我现在做了两个界面,一个主界面,代码如下:
----------------------
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
----------------------
Private Sub book_in_Click()
frmbookin.Show
End Sub
Public Sub Form_Load()
conn.ConnectionString = "Driver={sql server};server=wxfjx;uid=sa;pwd=;database=book "
conn.Open
'连接数据库
frmMain.Caption = "图书馆管理系统 "
frmMain.Top = (Screen.Height - frmMain.Height) / 2
frmMain.Left = (Screen.Width - frmMain.Width) / 2 '窗口居中
End Sub
---------------------
然后又做了一个界面,按钮点击进去
代码如下:
------------------------------
Private Sub cmd_exit_Click()
Unload Me
End Sub
--------------------------------
Private Sub cmd_save_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
If ((Text_isbn.Text = " ") And (Text_bname.Text = " ") And (Text_author.Text = " ") And (Text_total.Text = " ")) Then
Beep
MsgBox " 请将各项数据填写完整! ", 48, "警告! "
Else
sql = "select * from book where isbn= ' " & Text_isbn.Text & " ' "
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs.EOF Then
rs.AddNew
rs.Fields(0) = Trim(Text_isbn.Text)
rs.Fields(1) = Trim(Text_bname.Text)
rs.Fields(2) = Trim(Text_author.Text)
rs.Fields(3) = 0
rs.Fields(4) = Trim(Text_price.Text)
rs.Fields(5) = Trim(Text_total.Text)
rs.Update
MsgBox "0000000 "
rs.Close
End If
End If
End Sub
------------------------
Private Sub Form_Load()
frmbookin.Top = (Screen.Height - frmbookin.Height) / 2
frmbookin.Left = (Screen.Width - frmbookin.Width) / 2
Label_isbn.Caption = "国际标准编号: "
Label_bname.Caption = "书名: "
Label_author.Caption = "作者: "
Label_price.Caption = "价格: "
Label_total.Caption = "总数: "
Text_isbn.Text = " "
Text_bname.Text = " "
Text_author.Text = " "
Text_price.Text = " "
呵呵,您别笑话,自学,还是第一次。
我现在做了两个界面,一个主界面,代码如下:
----------------------
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
----------------------
Private Sub book_in_Click()
frmbookin.Show
End Sub
Public Sub Form_Load()
conn.ConnectionString = "Driver={sql server};server=wxfjx;uid=sa;pwd=;database=book "
conn.Open
'连接数据库
frmMain.Caption = "图书馆管理系统 "
frmMain.Top = (Screen.Height - frmMain.Height) / 2
frmMain.Left = (Screen.Width - frmMain.Width) / 2 '窗口居中
End Sub
---------------------
然后又做了一个界面,按钮点击进去
代码如下:
------------------------------
Private Sub cmd_exit_Click()
Unload Me
End Sub
--------------------------------
Private Sub cmd_save_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
If ((Text_isbn.Text = " ") And (Text_bname.Text = " ") And (Text_author.Text = " ") And (Text_total.Text = " ")) Then
Beep
MsgBox " 请将各项数据填写完整! ", 48, "警告! "
Else
sql = "select * from book where isbn= ' " & Text_isbn.Text & " ' "
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs.EOF Then
rs.AddNew
rs.Fields(0) = Trim(Text_isbn.Text)
rs.Fields(1) = Trim(Text_bname.Text)
rs.Fields(2) = Trim(Text_author.Text)
rs.Fields(3) = 0
rs.Fields(4) = Trim(Text_price.Text)
rs.Fields(5) = Trim(Text_total.Text)
rs.Update
MsgBox "0000000 "
rs.Close
End If
End If
End Sub
------------------------
Private Sub Form_Load()
frmbookin.Top = (Screen.Height - frmbookin.Height) / 2
frmbookin.Left = (Screen.Width - frmbookin.Width) / 2
Label_isbn.Caption = "国际标准编号: "
Label_bname.Caption = "书名: "
Label_author.Caption = "作者: "
Label_price.Caption = "价格: "
Label_total.Caption = "总数: "
Text_isbn.Text = " "
Text_bname.Text = " "
Text_author.Text = " "
Text_price.Text = " "