Untitled
ElseIf fld = "IncidentType" Then rw.IncidentTypeName = Nz(vallnx, "") _contextinci.SaveChanges() Dim strx As String = "", wstrx As String = "", jobnum As Integer = 0 Dim parm As New SqlParameter() With { .ParameterName = "@MyId", .SqlDbType = SqlDbType.Int, .Direction = System.Data.ParameterDirection.Output } Dim jobrw As New jobnummain jobrw.yes = True _contextmain.jobnummain.Add(jobrw) _contextmain.SaveChanges() jobnum = jobrw.jobnumid strx = "exec @MyId = [" & Session("dbname") & "].dbo.[chkNfirs] @incNum=" & incidentid & ", @exponum=" & ExposureNum & ", @jobnum=" & jobnum & ", @updfields = 1" 'עבד לאט יותר ועף על 'TIME OUT '_contextnif.Database.Connection.ConnectionString = _contextnif.Database.Connection.ConnectionString '_contextnif.Database.ExecuteSqlCommand(strx, parm) Using connection = New SqlConnection(_contextinci.Database.Connection.ConnectionString) Dim command As New SqlCommand(strx, connection) command.Connection.Open() command.CommandTimeout = 1500 '1000 שניות command.Parameters().Add(parm) command.ExecuteNonQuery() End Using strx = "UPDATE ApparatusINC" strx = strx & " Set PrimaryUse = Case When isnull(isems, 0) = 1 And isnull(isSupp, 0) = 0 And isnull(isother, 0) = 0 Then 2 " strx = strx & " When isnull(isems, 0) = 0 And isnull(isSupp, 0) = 1 And isnull(isother, 0) = 0 Then 1 " 'strx = strx & " When isnull(isems, 0) = 0 And isnull(isSupp, 0) = 0 And isnull(isother, 0) = 1 Then 0 " 'strx = strx & " Else Case When " & Val(vall) & " > 99 And " & Val(vall) & " <200 Then 1 " 'strx = strx & " When " & Val(vall) & "> 299 And " & Val(vall) & " <400 Then 2 " 'strx = strx & " Else 0 End " strx = strx & " Else PrimaryUse End" strx = strx & " FROM ApparatusINC inner JOIN" strx = strx & " Apparatus On ApparatusINC.UnitID= Apparatus.AppID" strx = strx & " WHERE isnull(PrimaryUse,0)=0 And (ApparatusINC.Incident = " & incidentid & ") And (ApparatusINC.Exposure = " & ExposureNum & ")" _contextinci.Database.ExecuteSqlCommand(strx)
Leave a Comment