[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

BC30002: Type 'dataset' is not defined.

Posted on 2010-01-06
21
Medium Priority
?
2,752 Views
Last Modified: 2012-05-08
I've searched the Net over and have not found true love.  My app was running on our server, then I added a dataset class...now all I get is this BC30002 error on all my dataset classes in the app.
I tried the varied solutions I found all to no avail.  Most reference vs 2003 and 2005...I am running with VS 2008 using VB asp.net
One thing I found that I cannot explain is in the project's obj\debug\HARM.xml file...all the member names have T: or M: or F: prepended to the class name.  Don't know if this is relevant.
I get this when trying to run the app on our server and when trying to run it within VS2008.
Can anyone point me to something...please??
0
Comment
Question by:Dalexan
  • 11
  • 10
21 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26196713
I think that you will need to show more detail on the error that you are getting.  Are you trying to reference the System.Data.DataSet class, and inside of your project you have a DataSet class of your own?
0
 

Author Comment

by:Dalexan
ID: 26200985
I created a dataset by right-clicking the project and selecting Add/New Item.  The object and code generated are shown in the image I have attached.  The T: M: and F: I referred to can be seen in the attached xml file.  The error I get is:

Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'dsCAMPAIGN_SCRIPT_VIEW' is not defined.

Source Error:

Line 11:     End Sub
Line 12:
Line 13:     Public Function GetData(ByVal filter As String) As dsCAMPAIGN_SCRIPT_VIEW
Line 14:         bc = New bcSqlServer(mySession)
Line 15:         Return bc.GetDs(filter, New dsCAMPAIGN_SCRIPT_VIEW)

Source File: C:\projects\HMRAM\HarpARM\App_Code\Agent_Apps\BC\bcCAMPAIGN_SCRIPT_VIEW.vb    Line: 13

HarpARM.PNG
HARM.xml
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26201666
If you created the typed DataSet, the proxy code generator will assign it a namespace.  If the namespace is not the same as the default project namespace, then you will need an Imports statement at the top of the code module for the typed DataSet's namespace.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Dalexan
ID: 26205492
I don't see any namespace assignments...as you can see, the bc and ds files are both directly under the project namespace 'HARM'; although the bc file was not when I first checked...I had to remove it, add it under the project, save it, then move it to the subfolder where it now resides (the same folder it was in as shown in my earlier post).  I've had an issue with classes not registering properly in the past...mostly with the ds classes.  This has been more prevalent in 2008 and usually not a problem in 2005.
HarpARM2.PNG
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26206727
I was confusing the DataSet for the table adapter.  If you look at that image, you can see that the table adapters are listed in the class view under the namespaces, like dsACCESS_CODES.  

What kind of database working with?
0
 

Author Comment

by:Dalexan
ID: 26285991
We are accessing a MS SQL Server 2000 database.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26286621
Since you have SQL Server databases, have you looked at the LINQ-to-SQL DataContexts?  There is a significant improvement over the table adapters.
0
 

Author Comment

by:Dalexan
ID: 26287369
No, I haven't...this is a project I'm porting to another environment that was developed 3 years ago.  Not being familiar with the LINQ stuff, I haven't even looked.  Would it be a significant change to convert?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26287521
Well, that depends on different factors:

1) How the project is designed, and if you are using wrapper classes that hide the data access layer implementations.  

2) Your level of experience with LINQ

3) Your ability to learn new things.

4) Available development time

If none of these are enticing enough, then another approach that I would suggest--recreate the typed DataSets in 2008, since migration is not always perfect.
0
 

Author Comment

by:Dalexan
ID: 26288324
Time is probably the worst constraint...we wrapped everything down to the database in classes, so actual db access is constrained to a small area.  What I know of LINQ is minimal but I can learn.

Oh, yes, and I already did delete all the ds's and recreated them from scratch in 2008...along with the bc classes...didn't help.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26289634
Can you show me some of the code generated for the problem typed DataSet designer file?  

Example:


'------------------------------------------------------------------------------
' <auto-generated>
'     This code was generated by a tool.
'     Runtime Version:2.0.50727.4927
'
'     Changes to this file may cause incorrect behavior and will be lost if
'     the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On



'''<summary>
'''Represents a strongly typed in-memory cache of data.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"),  _
 Global.System.Serializable(),  _
 Global.System.ComponentModel.DesignerCategoryAttribute("code"),  _
 Global.System.ComponentModel.ToolboxItem(true),  _
 Global.System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema"),  _
 Global.System.Xml.Serialization.XmlRootAttribute("AdventureWorksDataSet"),  _
 Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")>  _
Partial Public Class AdventureWorksDataSet
    Inherits Global.System.Data.DataSet

Open in new window

0
 

Author Comment

by:Dalexan
ID: 26293312
Here's the designer file for the dataset...
dsCAMPAIGN-SCRIPT-VIEW.Designer.vb
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26293854
Hmmm...that looks just fine.  What type of web site are you working with (Web Site model = no project file, or Web Application model = project file)?  For the Web Site model, data classes should be in the App_Code folder.
0
 

Author Comment

by:Dalexan
ID: 26294530
I think the correct answer is Web Application...just a master page, web.config, and all the other pages and classes in the project folder.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26298371
I believe that the correct answer, if there is no .vbproj file, is Web Site model, which means that the DataSet files need to be in the App_Code folder.  When you add a new DataSet, and that folder doesn't exist, then the IDE asks if you would like to add that folder, and then it places the DataSet files in the App_Code folder.
0
 

Author Comment

by:Dalexan
ID: 26298742
hmmm, well, I do have a HARM.vbproj file...it's attached...
HARM.vbproj
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26299632
Everything looks good, and there is nothing that explains your problem.  Can you create a new test web application, create a typed DataSet, and have it work correctly?
0
 

Author Comment

by:Dalexan
ID: 26342828
I apologize for the delay...my job includes current maintenance, customer support, and development of future apps.  Unfortunately, future apps gets the back seat.
I created a new app and added a dataset to it with no problems...including populating a dropdown list.
I've been spending a lot of time on this...first it works (I had 9 datasets in the app and it was working), then I add a dataset, and everything fails.
I think I'm at the point where I need to start from scratch and upgrade the design to use LINQ, etc.  Do you have any get-up-and-running-quick references I might use?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 26342963
LINQ is a pretty large subject to cover, and I have used a lot of references to get where I am today, but I don't have a specific quick start reference in mind.

Let's come up with one:

1) Add a data layer class library project to your solution

2) A LINQ-to-SQL file to the data layer project (Add New Item | LINQ to SQL Classes).

3) Drag and drop tables from the Server Explorer, with a connection defined to the SQL Server database, to the DataContext designer surface.  Relationships between tables will automatically create associations for the tables on the DataContext designer.

4) Drop stored procedures on the right-hand pane, to create methods that will execute the stored procedures.

5) Add a class to the project that will create an instance of the DataContext

6) Add methods to the DataContext class to get the data that you need.

7) There are plenty of resources to learn how to create LINQ statements the duplicate the SQL Server queries.  Most are language specific, so you would need to find VB.NET examples.

    A good search expression is your best friend (i.e. VB.NET LINQ examples)

    101 LINQ Examples
    http://msdn.microsoft.com/en-us/vbasic/bb688088.aspx


Public Class DataLayer

    Private m_dataContext As AdventureWorksDataContext = Nothing

    Public Sub New(ByVal connectionString As String)

        If String.IsNullOrEmpty(connectionString) Then
            m_dataContext = New AdventureWorksDataContext()
        Else
            m_dataContext = New AdventureWorksDataContext(connectionString)
        End If

    End Sub

    Public Function GetProductList() As List(Of Product)

        Dim query = From product In m_dataContext.Products _
                    Order By product.Name _
                    Select product

        Return query.ToList()
    End Function

End Class

Open in new window

Screenshot.png
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 26342980
Remember that what ever technology that you use for a data access layer, the best practice is to design one that can be easily changed out, without breaking code.  That is not as easy to achieve as it sounds.  My goal is to create something that requires only a minimal amount of changes.  I like the ease of use with LINQ-to-SQL, and love the power of LINQ.
0
 

Author Closing Comment

by:Dalexan
ID: 31679806
Beautiful.  It looks so simple and elegant.
If anyone else is dealing with this type of problem, LINQ may be the real solution.
Since VS2008 still has bugs in dealing with ds's and can't seem to get it's head on straight with it all, porting this old code is a waste of time; and I wasted a LOT of time fighting with this.
LINQ, by your description and example, and by the examples your link pointed to, I'm convinced that's the way to go. (hopefully, it doesn't have the same kind of 'bugs')
THANK YOU!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month19 days, 1 hour left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question