posts - 9,  comments - 0,  trackbacks - 0
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)  编辑 收藏 引用 所属分类: 参考文
只有注册用户登录后才能发表评论。

<2024年12月>
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

常用链接

留言簿(1)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜