hello,
I'm trying to use a query that is not the "regular" fill / getdata functions that used in tableadapters.
I've creaed a new functions - getdataby(where) and fillby(where)
which gets a "WHERE..." string to add a condition to the regular fill.
I use 3tier application, like this:
In eqsystemDBDataSet.Designer.vb file
In Dal project:
In BL project:
In application project:
MY PROBLEM- when I run the app in debug I see in the Designer.vb file that I get the correct data in the datatable, but when I keep running and go back to the function in the application I get empty datatable.
what can be the problem?
BTW- I tried using the "<global.. etc." that is now in comment but then I can't debug this part and still, the datatable is empty
10x!
I'm trying to use a query that is not the "regular" fill / getdata functions that used in tableadapters.
I've creaed a new functions - getdataby(where) and fillby(where)
which gets a "WHERE..." string to add a condition to the regular fill.
I use 3tier application, like this:
In eqsystemDBDataSet.Designer.vb file
VB.NET:
' <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
' Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"), _
'Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, True)> _
Public Overridable Overloads Function Fillby(ByVal dataTable As eqsystemDBDataSet.WorkersINeventDataTable, ByVal wherexp As String) As Integer
Dim returnValue As Integer
Me.Adapter.SelectCommand = Me.CommandCollection(0)
Try
Me.CommandCollection(0).CommandText += wherexp
If (Me.ClearBeforeFill = True) Then
dataTable.Clear()
End If
returnValue = Me.Adapter.Fill(dataTable)
Return returnValue
Catch ex As Exception
End Try
'Return returnValue
End Function
' <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
' Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"), _
' Global.System.ComponentModel.DataObjectMethodAttribute
(Global.System.ComponentModel.DataObjectMethodType.[Select], True)> _
Public Overridable Overloads Function GetDataby(ByVal wherexp As String) As eqsystemDBDataSet.WorkersINeventDataTable
Me.Adapter.SelectCommand = Me.CommandCollection(0)
Dim dataTable As eqsystemDBDataSet.WorkersINeventDataTable
dataTable = New eqsystemDBDataSet.WorkersINeventDataTable
Try
Me.CommandCollection(0).CommandText += wherexp
Me.Adapter.Fill(dataTable)
Catch ex As Exception
End Try
Return dataTable
End Function
VB.NET:
Public Class cldb
Public Function getworkersbydate(ByVal stwhere As String) As eqsystemDBDataSet.WorkersINeventDataTable
Dim CustDa As New eqsystemDBDataSetTableAdapters.WorkersINeventTableAdapter
CustDa.GetDataby(stwhere)
Return CustDa.GetDataby(stwhere)
End Function
End class
VB.NET:
Public Class StoredProcedures
Public Function getworkersbydate(ByVal where As String) As DataTable
Dim custdal As New clDB
custdal.getworkersbydate(where)
Return custdal.getworkersbydate(where)
End Function
End class
In application project:
VB.NET:
Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim wherestr As String
wherestr = " WHERE ArrivedWorkers.[xdate] like '%" & Date.Today & "%'"
dt = storedprocedures.getworkersbydate(wherestr)
dgworkers.DataSource = dt
End Sub
MY PROBLEM- when I run the app in debug I see in the Designer.vb file that I get the correct data in the datatable, but when I keep running and go back to the function in the application I get empty datatable.
what can be the problem?
BTW- I tried using the "<global.. etc." that is now in comment but then I can't debug this part and still, the datatable is empty
10x!