Datatable: works in windowsApp, not in ASP.NET
Hi all,
I've got a very weird problem. I'm trying to retrieve a datatable and in my view this works. Here's my (test) code in ans ASP.NET code page.
1Public Sub New()
2 cls_datamanager =New DataManager()
3 Get_errors()
4End Sub 5 6 Public Sub
7Dim cls_ErrorAs New Error_Logger(cls_datamanager)
8Dim cls_datatableAs New DataTable
9 cls_datatable = cls_Error.List_errors
10
11'grd_errors.DataSource
12 lbl_test.Text = cls_datatable.Rows(0).Item(0)
13
14End Sub
cls_error and cls_datamanager are some classes for DAL and three tier development I use and they work.
I get a NullReference Exception when I get to the last line of code. The strange thing is when I do exactly the same in a windowsapplication (see below) this gives me no problem at all. And it uses the same assmeblies!
When debugging I also see this datatable DOES have 2 rows and 5 columns, as is expected. The Stored Procedure that is behind works fine and does not need any paramaters, it basically does a select *.
I have no idea why I get a this error. In my SQL Profiler I see the correct SQL Stored proc passing by so it retrieves the data correctly
This is a small windowsapplication I used to test my datamanager and error_logger classes and as mentioned above, this works without error.
1Private Sub Form1_Load(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles MyBase.Load
2
3Try 4 Dim
5Dim keyAs Integer
6
7
8
9
10
11 cls_datamanager =New DataManager
12
18
19Dim cls_errorAs New Error_Logger(cls_datamanager)
20Dim cls_datatableAs DataTable
21 cls_datatable = cls_error.List_errors
22 MessageBox.Show(cls_datatable.Rows(1).Item(1))
23
24
25Catch exAs Exception
26 MessageBox.Show(ex.Message)
27End Try
-->c This does return the data in column 1 of row 1
Any help would be appreciated

