Imports System
Imports System.Data
Imports System.Drawing
Imports System.Data.OleDb
Module ConnToDB
Public StartPath As String = Application.StartupPath & "\LiberySystem"
Public Connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
Public ConnectStr As String = Connstr & "Data Source=" & StartPath
Public DataAdapter As OleDbDataAdapter
Public DataConnection As OleDbConnection
Public DataSet As DataSet
Public Function GetDataFromDB(ByVal sqlstr As String) As DataSet
Try
DataConnection = New OleDbConnection
DataConnection.ConnectionString = ConnectStr
DataAdapter = New OleDbDataAdapter(sqlstr, DataConnection)
DataSet = New DataSet
DataSet.Clear()
DataAdapter.Fill(DataSet)
DataConnection.Close()
Catch
MsgBox(Err.Description)
End Try
If DataSet.Tables(0).Rows.Count > 0 Then
Return DataSet
Else
Return Nothing
End If
End Function
Public Function UpdateDataBase(ByVal sqlstr As String) As Boolean
Dim sqlconn As OleDbConnection
Try
Dim cmdTable As OleDbCommand = New OleDbCommand(sqlstr, sqlconn)
cmdTable.CommandType = CommandType.Text
sqlconn.Open()
cmdTable.ExecuteNonQuery()
sqlconn.Close()
Catch
MessageBox.Show(Err.Description)
End Try
Return True
End Function
Public Class Dictionary
Public ISBN As String
Public FineBase As Double
Public FineMulti As Double
Public FineFactor As Double
End Class
Public Structure OnceLends
Public ReadStyle As String
Public LendBooks As Integer
End Structure
Public Structure BorrowType
Public Type As String
Public Days As Integer
End Structure
End Module
posted on 2006-11-19 10:40
MT'S BLOG 阅读(298)
评论(0) 编辑 收藏 引用 所属分类:
参考文