vb.net query update

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

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...