Accessing a dataset in another project...

EricTheViking

New member
Joined
Mar 19, 2008
Messages
1
Programming Experience
10+
Hello,

I'm working on a VB.NET App, VS2008 using .Net 2.0.

What I have is a solution with two projects in it. One project is a Winforms app, the other is a class library project that is my data access layer.

The class library has a single dataset in it that contains a single table. The database it refers to is SQL2005.

In my windows app I want to bind controls to the dataset in the class library - but can't get it to work.

Under project datasources I added an Object datasource that references the dataset in my class library. When I drag the table from the datasource explorer to the form I get the design time data grid, with a navigation control and a dataset component is added to the form designer along with binding source controls for the data and navigator.

When I run the app the control doesn't bind and sits there looking blank.

If I use a dataset within the app project it works fine!

I notice that when creating the data grid from the class library projct data source there is no table adapter added to the form.


So in summary how do I data bind to a dataset in a different project within a solution?

Any suggestion gratefully received! :)
 
It's actually real easy, but don't use the form drop it actually makes things more confusing.

PROJECT 1 Main app
VB.NET:
Imports System.Data
Imports DataAccessLayer
Private Class GetMyData

Private _MyDataSet as dataset =nothing
 
Private Function getDataset() as dataset
dim dal as new MyDataLayer
_MyDataSet = dal.GetMyDataset()
if not _Mydataset is nothing
msgbox("I got my data")
end if

end function
end class

Project 2 DataAccessLayer
VB.NET:
Public Class mydatalayer
public Function GetMyDataSet() as Dataset
'Code to call function to get data set here
return myfunctiontogetdatasetname
end function
end class
 
Hello all. I am having the exact issue described by Eric. However I am not entirely following Vinnie's solution. Has anyone else encountered this issue and if so how were you able to resolve it?

Thanks...
 

Latest posts

Back
Top