merestoneaccess.vb

来自「界桩信息管理系统代码,VB写的。。。。。。。」· VB 代码 · 共 346 行 · 第 1/3 页

VB
346
字号
    End Sub

#End Region

    '保存数据
    Public Function Update(ByVal merestone As MereStoneData) As Boolean
        Try
            dsCommand.Update(merestone, merestone.MereStone.TableName)
        Catch ex As Exception
            Update = False
        End Try

        If merestone.HasErrors Then
            merestone.Tables(merestone.MereStone.TableName).GetErrors(0).ClearErrors()
            Update = False
        Else
            merestone.AcceptChanges()
            Update = True
        End If
    End Function

    '查看所有具体部件的数据
    Public Function LoadAllData(Optional ByVal merestone As MereStoneData = Nothing) As MereStoneData
        If merestone Is Nothing Then merestone = New MereStoneData
        Try
            merestone.Clear()
            dsCommand.Fill(merestone, merestone.MereStone.TableName)
        Catch ex As Exception
            ex.ToString()
        End Try

        Return merestone
    End Function

    '根据具体界桩地图ID查询具体部件的数据
    Public Function LoadAllDataByMapID(ByVal id As Integer, Optional ByVal merestone As MereStoneData = Nothing) As MereStoneData
        If merestone Is Nothing Then merestone = New MereStoneData
        Dim strSql As String
        Dim loadCmd As OleDbCommand

        strSql = loadCommand.CommandText & " where " & merestone.MereStone.MAPINFO_IDColumn.ColumnName & "=@id"
        loadCmd = New OleDbCommand(strSql, dsConnection)
        loadCmd.Parameters.Add("@id", id)

        Try
            merestone.Clear()
            With dsCommand
                .SelectCommand = loadCmd
                .Fill(merestone, merestone.MereStone.TableName)
            End With
        Catch ex As Exception
            ex.ToString()
        End Try

        loadCmd.Dispose()
        loadCmd = Nothing

        Return merestone
    End Function


    '根据具体界桩编号查询具体部件的数据
    Public Function LoadAllDataByMS_bh(ByVal code As String, Optional ByVal merestone As MereStoneData = Nothing) As MereStoneData
        If merestone Is Nothing Then merestone = New MereStoneData
        Dim strSql As String
        Dim loadCmd As OleDbCommand

        strSql = loadCommand.CommandText & " where " & merestone.MereStone.jzbhColumn.ColumnName & "=@code"
        loadCmd = New OleDbCommand(strSql, dsConnection)
        loadCmd.Parameters.Add("@code", code)

        Try
            merestone.Clear()
            With dsCommand
                .SelectCommand = loadCmd
                .Fill(merestone, merestone.MereStone.TableName)
            End With
        Catch ex As Exception
            ex.ToString()
        End Try

        loadCmd.Dispose()
        loadCmd = Nothing

        Return merestone
    End Function

    '根据具体界桩名称查询具体部件的数据
    Public Function LoadAllDataByMS_mc(ByVal name As String, Optional ByVal merestone As MereStoneData = Nothing) As MereStoneData
        If merestone Is Nothing Then merestone = New MereStoneData
        Dim strSql As String
        Dim loadCmd As OleDbCommand

        strSql = loadCommand.CommandText & " where " & merestone.MereStone.jzmcColumn.ColumnName & "=@name"
        loadCmd = New OleDbCommand(strSql, dsConnection)
        loadCmd.Parameters.Add("@name", name)

        Try
            merestone.Clear()
            With dsCommand
                .SelectCommand = loadCmd
                .Fill(merestone, merestone.MereStone.TableName)
            End With
        Catch ex As Exception
            ex.ToString()
        End Try

        loadCmd.Dispose()
        loadCmd = Nothing

        Return merestone
    End Function

End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?