WordTechinc
Programmer
- Sep 4, 2009
- 38
I excuted SP but return value zero. I think the table using in SP is deleting and writing by parameter by another SP.
How to get return value while other SP is deleting and writing same sql table by job number?
Private Function getSavedJobs()
Dim cmdSavedJobs As New SqlCommand
Dim objSqAd As New SqlDataAdapter
Try
con = GetConnection()
dtJobs.Columns.Add("Select", Type.GetType("System.Boolean"))
dtJobs.Columns("Select").DefaultValue = False
With cmdSavedJobs
.Connection = con
.CommandType = CommandType.StoredProcedure
.CommandText = "INRv2_GetAllSavedJobs"
End With
objSqAd.SelectCommand = cmdSavedJobs
objSqAd.Fill(dtJobs) ******* this returns zero *****
Dim d(0) As DataColumn
d(0) = dtJobs.Columns(1)
dtJobs.PrimaryKey = d
Dim dr1 As DataRow
If Not objMergeJob.dtSelJobs Is Nothing Then
For Each dr As DataRow In objMergeJob.dtSelJobs.Rows
dr1 = dtJobs.Rows.Find(dr(1))
dr1(0) = True
Next
dtArr = dtJobs.Select("Select = True")
End If
'objMergeJob.dtSelJobs.Rows.Find
intRowCount = dtJobs.Rows.Count
objtableStyle.MappingName = dtJobs.TableName
fnFormatDataGrid()
objtableStyle.AllowSorting = False
dbgJob.TableStyles.Add(objtableStyle)
dbgJob.DataSource = dtJobs
dbgJob.Focus()
Catch ex As Exception
MessageBox.Show(dtJobs.Rows.Count) '' suk 20121112 wt
Console.WriteLine(ex.ToString)
''MessageBox.Show(ex.ToString) '' suk 20121112
End Try
End Function
How to get return value while other SP is deleting and writing same sql table by job number?
Private Function getSavedJobs()
Dim cmdSavedJobs As New SqlCommand
Dim objSqAd As New SqlDataAdapter
Try
con = GetConnection()
dtJobs.Columns.Add("Select", Type.GetType("System.Boolean"))
dtJobs.Columns("Select").DefaultValue = False
With cmdSavedJobs
.Connection = con
.CommandType = CommandType.StoredProcedure
.CommandText = "INRv2_GetAllSavedJobs"
End With
objSqAd.SelectCommand = cmdSavedJobs
objSqAd.Fill(dtJobs) ******* this returns zero *****
Dim d(0) As DataColumn
d(0) = dtJobs.Columns(1)
dtJobs.PrimaryKey = d
Dim dr1 As DataRow
If Not objMergeJob.dtSelJobs Is Nothing Then
For Each dr As DataRow In objMergeJob.dtSelJobs.Rows
dr1 = dtJobs.Rows.Find(dr(1))
dr1(0) = True
Next
dtArr = dtJobs.Select("Select = True")
End If
'objMergeJob.dtSelJobs.Rows.Find
intRowCount = dtJobs.Rows.Count
objtableStyle.MappingName = dtJobs.TableName
fnFormatDataGrid()
objtableStyle.AllowSorting = False
dbgJob.TableStyles.Add(objtableStyle)
dbgJob.DataSource = dtJobs
dbgJob.Focus()
Catch ex As Exception
MessageBox.Show(dtJobs.Rows.Count) '' suk 20121112 wt
Console.WriteLine(ex.ToString)
''MessageBox.Show(ex.ToString) '' suk 20121112
End Try
End Function