加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

vb.net query update

发布时间:2020-12-17 07:53:45 所属栏目:百科 来源:网络整理
导读:Imports Gates.MES.DA Imports System.Data Imports System.Data.SqlClient Namespace BL Public Class QueyUpdate Private _DBTans As DBTransaction Private _errorMessage As String = "" Public Sub New(ByVal DBTrans As DBTransaction) _DBTans = DBTr

Imports Gates.MES.DA
Imports System.Data
Imports System.Data.SqlClient

Namespace BL
Public Class QueyUpdate

Private _DBTans As DBTransaction
Private _errorMessage As String = ""

Public Sub New(ByVal DBTrans As DBTransaction)
_DBTans = DBTrans
End Sub


Public ReadOnly Property errorMessage() As String
Get
Return _errorMessage
End Get
End Property
Public Function QuerySplitJob(ByVal Job As String) As DataSet
Dim strSQL As String = ""
Dim resultDS As New DataSet
Try
strSQL = "select * from [MES_TRANS_MCD].[APPS].[HDMT_LOG] where lotid ='" & _
Job & "' and secondLOTID ='" & Job & "'"
resultDS = _DBTans.SqlToDataSet("splitJOb",strSQL)
Return resultDS
Catch ex As Exception

Throw ex

End Try
End Function

Public Function GetJobbyPN(ByVal PN As String) As DataSet
Dim strSql As String
Dim resultDS As New DataSet

Try

strSql = " select * from apps.releasedjob where 1=1 "
If PN <> "" Then
strSql &= " and partnumber ='" & PN & "'"

End If

resultDS = _DBTans.SqlToDataSet("test",strSql)

Return resultDS

Catch ex As Exception
Throw ex


End Try
End Function


Public Function InsertSpliJob(ByVal sJob As SplitJob) As Boolean
Dim strSQL As String = ""
Dim newQty As Integer = 0
Try

_DBTans.BeginTransaction()
strSQL = "insert into [MES_TRANS_MCD].[APPS].[HDMT_LOG] ( lotid,partno,mesqty,SecondLotid) " & _
" values ( '" & sJob.NewJob & "','" & sJob.NewQty & "','" & sJob.OriginalJob & "')"

_DBTans.ExecSQL(strSQL)
newQty = sJob.OriginalQTY - sJob.NewQty
strSQL = " Update [MES_TRANS_MCD].[APPS].[HDMT_LOG] set mesqty= " & newQty & " where lotid= '" & sJob.OriginalJob & "')"

_DBTans.ExecSQL(strSQL)

_DBTans.CommitTransaction()

Catch ex As Exception
_DBTans.RollbackTransaction()
Throw ex
Return False

End Try
End Function

End Class
Public Class SplitJob
Public OriginalJob As String
Public pn As String
Public OriginalQTY As Integer
Public NewQty As Integer
Public NewJob As String

End Class

End Namespace

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读