Header Ads

  • Breaking News

    การใช้งาน DataReader + Read data

    BeginTrans()
    Dim rss As OleDbDataReader
    Dim sssSQL As String  = "SELECT * FROM TBD_STKDETAILS"
                rss = ExcuteReader(sssSQL)

                rss.Read()                          '' อ่านค่า จาก ExcuteReader
                If rss.HasRows Then
                    strSQL = "UPDATE TBD_STKDETAILS SET" & _
                       " RECQTY = RECQTY + " & Trim(RECQTYstk) & " " & _
                       " ,STKQTY = STKQTY + " & Trim(STKQTYstk) & " " & _
                       " ,CTNSEQTO = CTNSEQTO + " & Trim(CTNSEQTO) & " " & _
                       " ,UPDDTE = sysdate " & _
                       " WHERE CTNSPLNO='" & CTNSPLNO & " '"

                    TransExeSQL(strSQL)
                Else
    End if

    -----------------------------------------------------------------------------
        Public Function ExcuteReader(sTr As String) As OleDbDataReader
            If Not dbCon.State = ConnectionState.Open Then
                dbCon.Open()
            End If
            Try
                dbCmd = New OleDbCommand(sTr, dbCon)
                ExcuteReader = dbCmd.ExecuteReader
                Return ExcuteReader
            Catch ex As Exception

            End Try
        End Function

    ไม่มีความคิดเห็น

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728