Re: VB.NET Data Access Layer
Are you absolutely certain that those are the lines that are throwing the error, and that the code you pasted is the same code that is causing your issue?
I only ask because your code is perfectly valid and should not be causing those errors.
I downloaded the sample C# code and re-wrote the exact example you have in vb.net, but cannot reproduce the issue.
The only thing I didn't do and I don't know if you did or not. I did not covert the rest of the project to vb.net. I simply referenced the C# project from my VB.NET project.
Re: VB.NET Data Access Layer
Well...First of all thank you vert much for the reply
My problem is, I am working on a similar sample. I should have told you that. But due to some rules of Non disclosure agreement, I cannot post any code here...that is why I did some analogy. If you say, that the code working is fine, then I would go ahead with it. Because, it is just the intellisense error in the form of a underlining & a tool-tip when you hover over the class and not compiler error. As evident from the past, these errors go away when you finish the application. However, the application is a lot bigger than what the codeproject link has and I was trying to save myself some debugging by getting rid of this early.
Having said that, let us consider that portion of CustomerOrderService again:
Code:
' m_customersAdapter is an instance and I am having problem instantiating it...
' m_OrdersAdapter is also having the same issue
'I was asking, if there is another syntax for declaring the same. I am C# mostly (about 75%)
'But I have worked with VB.NET without much problems before
'The public region is reproduced here...
....
....
Public Function GetCustomers() As CustomerOrderTDS.CustomersDataTable
Return CustomersAdapter.GetData()
End Function
Public Function GetOrders() As CustomerOrderTDS.OrdersDataTable
Return OrdersAdapter.GetData()
End Function
Public Function GetCustomerOrders() As CustomerOrderTDS
Return CustomerOrderTDS.GetCustomerOrders()
End Function
'I cannot use the "." operator on the properties...
'Ofcourse I can work without intellisense, but it would be a nightmare for debugging
Since you are more acquainted with VB.NET, I would like to ask you the possibilities here...which I will have to eventually deal with while debugging
Thanks & regards,
Bhushan
Re: VB.NET Data Access Layer
Intellisense works because of this line:
Code:
using DCAF.DataLayer.CustomerOrderTDSTableAdapters;
in VB.Net
Code:
Imports DCAF.DataLayer.CustomerOrderTDSTableAdapters
does the same thing. it gives access to protected methods
Re: VB.NET Data Access Layer
I know...
What I was suggesting was ...it was not working and there is something definitely wrong
And I have posted the tool-tip error message I am seeing on hovering over the underlined member
I want to know the situations where in I can get it....? In the meantime, I will also try and find out what the issue is and post it here if I happen to find it.
Thanks and regards,
Bhushan
Re: VB.NET Data Access Layer
In the code that I have posted, I am not able to see the GetData() method and GetCustomerOrders() method after I put a "." after the protected properties in the public methods.
I attribute this error to the underlines and the tool-tip error message I am getting there...
I hope that clears the problem just a little further...
Thanks,
Bhushan
Re: VB.NET Data Access Layer
Yeah, it's all a guessing game without understanding more about how you've coded this thing.
This code will produce the 1-dimensional array ERROR, as it's trying to assign a non-array variable to an array.
Code:
Dim thisIsAnArray() As Object
Dim thisIsNotAnArray As Object
thisIsAnArray = thisIsNotAnArray
Re: VB.NET Data Access Layer
Hi,
You won't find a more dumb person than me right now! Sorry for all your time who attended this thread.
At the same time, thanks to Craig Gemill. Your last post did the trick for me.
The problem was the right sort of definition. I am really livid with myself.
On reading your thread, of which I already had an idea but did not know where to start and this is where CG has always chipped in.
I have always wondered, how to decide what constructors do we put a parenthesis and not. If I had a slightest idea, I would not have run into this problem.
I am reproducing the code from previous posts in this thread in VB.NET here:
Code:
Imports DCAF.DataLayer.CustomerOrderTDSTableAdapters
Namespace DCAF.DataLayer
Partial Class CustomerOrderTDS
Public Shared Function GetCustomerOrders() As CustomerOrderTDS
Dim custAdapter As New CustomersTableAdapter() 'Parenthesis ...right or wrong?
Dim ordAdapter As New OrdersTableAdapter() 'Parenthesis ...right or wrong?
Dim ds As New CustomerOrderTDS() 'Parenthesis ...right or wrong?
custAdapter.Fill(ds.Customers)
ordAdapter.Fill(ds.Orders)
Return ds
End Function
End Class
End Namespace
'...
' This is the service class that connects the DAL classes to the Business Objects
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports DCAF.DataLayer.CustomerOrderTDSTableAdapters
Namespace DCAF.DataLayer
Public Class CustomerOrderService
#Region "Storage"
'In the following properties, I forgot to mention the return type!!!
'There was nothing like "As ....type"
'As a result, every property was treated like having a return type Object
'That is why my method won't show up
Private m_customersAdapter As CustomersTableAdapter = Nothing
Protected ReadOnly Property CustomersAdapter() As CustomersTableAdapter
Get
If m_customersAdapter Is Nothing Then
m_customersAdapter = New CustomersTableAdapter 'Removed () here...???
End If
Return m_customersAdapter
End Get
End Property
Private m_ordersAdapter As OrdersTableAdapter = Nothing
Protected ReadOnly Property OrdersAdapter() As OrdersTableAdapter
Get
If m_ordersAdapter Is Nothing Then
m_ordersAdapter = New OrdersTableAdapter 'Removed () here...???
End If
Return m_ordersAdapter
End Get
End Property
#End Region
#Region "Public Interface
Public Function GetCustomers() As CustomerOrderTDS.CustomersDataTable
Return CustomersAdapter.GetData()
End Function
Public Function GetOrders() As CustomerOrderTDS.OrdersDataTable
Return OrdersAdapter.GetData()
End Function
Public Function GetCustomerOrders() As CustomerOrderTDS
Return CustomerOrderTDS.GetCustomerOrders()
End Function
#End Region
End Class
End Namespace
After doing the changes, I can see everything working. The sample is not yet complete. But I am sure, it will work fine. Please correct me if I am still doing something wrong....
But I sinerely hope that Craig's post came to my rescue. Thisisanarray and thisisnotanarray!!! 2 objects defined...it cannot get any simpler
Too much of work can make you do dumb things as these...is what I have learned here.
Thanks again,
Bhushan