M
Marc Robitaille
Hello,
In my projet, there are class for each table of my database.So, if I want to
get, add, change or delete some thing in a table, I use the class that
correpond to it. I have this kind of code in all class. Usually, it has
allways work fine for all the projects that I have done. I don't know why,
but with a particular project, I have a lot of trouble. The code allways
jam on the DataAdapter Fill Line. Something, my web application is
incredibly fast, but sometime I can wait up to two minutes before the
execution of the Fill line finish and gets to the next statement. Do I miss
something in the configuration of my web application or maybe it is my SQL
Server that have a problem. I work on a computer that it is not connect to
a network so I am the only one who connect to the SQL Server.
Public Function GetTotalAvoir(ByVal pstrId As String, ByVal pstrNoPeriode As
String, ByVal pstrDSN As String)
Dim strCommande As String = ""
Try
strCommande = "SELECT TotalAvoir FROM Bilan WHERE NoCompagnie = " &
pstrId & " AND NoPeriode = " & pstrNoPeriode
Dim daDataAdapter As New SqlDataAdapter(strCommande, pstrDSN)
Dim dsDataSet As New DataSet()
daDataAdapter.Fill(dsDataSet, "Bilan")<-----------This is the line
with witch I have a lot of trouble
Dim dtDataTable As DataTable = dsDataSet.Tables(0)
If dtDataTable.Rows.Count > 0 Then
GetTotalAvoir = dtDataTable.Rows(0).Item(0)
Else
GetTotalAvoir = DBNull.Value
End If
dtDataTable = Nothing
daDataAdapter.Dispose()
Catch
Finally
End Try
End Function
Thank you
Marc
In my projet, there are class for each table of my database.So, if I want to
get, add, change or delete some thing in a table, I use the class that
correpond to it. I have this kind of code in all class. Usually, it has
allways work fine for all the projects that I have done. I don't know why,
but with a particular project, I have a lot of trouble. The code allways
jam on the DataAdapter Fill Line. Something, my web application is
incredibly fast, but sometime I can wait up to two minutes before the
execution of the Fill line finish and gets to the next statement. Do I miss
something in the configuration of my web application or maybe it is my SQL
Server that have a problem. I work on a computer that it is not connect to
a network so I am the only one who connect to the SQL Server.
Public Function GetTotalAvoir(ByVal pstrId As String, ByVal pstrNoPeriode As
String, ByVal pstrDSN As String)
Dim strCommande As String = ""
Try
strCommande = "SELECT TotalAvoir FROM Bilan WHERE NoCompagnie = " &
pstrId & " AND NoPeriode = " & pstrNoPeriode
Dim daDataAdapter As New SqlDataAdapter(strCommande, pstrDSN)
Dim dsDataSet As New DataSet()
daDataAdapter.Fill(dsDataSet, "Bilan")<-----------This is the line
with witch I have a lot of trouble
Dim dtDataTable As DataTable = dsDataSet.Tables(0)
If dtDataTable.Rows.Count > 0 Then
GetTotalAvoir = dtDataTable.Rows(0).Item(0)
Else
GetTotalAvoir = DBNull.Value
End If
dtDataTable = Nothing
daDataAdapter.Dispose()
Catch
Finally
End Try
End Function
Thank you
Marc