Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataSet is not defined

Status
Not open for further replies.

jelee2

Technical User
Apr 7, 2003
7
0
0
CA
Hi,
I'm creating ASP.NET webforms using Visual Studio.NET and VB.NET; I'm trying to use the SqlDataAdapters and generated DataSets. I can create the SqlDataAdapter and when I preview the data it is fine. Unfortunately, when I generate the DataSet, I get an error about the DataSet in the #Region. It says 'Type XXXXX.DataSet1 is not defined', where XXXXX is the name of my project. I tried deleting the name of my project, but once the solution is rebuilt, it regenerates the code and I get the same error. Does anyone know what could be the problem?

J
 
hey!
Can you show me you code?
Actually I don't write in VB.NET, I use C#, but I think there should not be any problems.
Best reagrds,
Alex
 
well, I've actually gotten around it by deleting the 'XXXXX' namespace. This is entirely ludicrous as I shouldn't have to fiddle with the code generated by the webform, but it's the only thing that will allow my datagrid to load properly.


#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.DataSet11 = New Tickets.DataSet1
Me.DataView1 = New System.Data.DataView
.
.
.
.
.
.
Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents DataSet11 As Tickets.DataSet1
Protected WithEvents DataView1 As System.Data.DataView
Protected WithEvents dgListings As System.Web.UI.WebControls.DataGrid
.
.
.


Tickets.DataSet1 is giving the problem 'Type Tickets.DataSet1 is not defined' and the page won't build. I have skirted the issue by deleting the 'Tickets',but if I continue to work on the page, it will regenerate it itself, creating the build error again.

james
 
Hey, look here is a code of some blank page with sql connection:

this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.dataSet = new ProjectName.DataSet2();
...
this.dataSet.DataSetName = "DataSet2";

ut it is C#. Actually I do not see a very big difference, but maybe you should define a name too? And of cource you didn't forget to add System.Data.SqlClient:)

But I think the best way it is to creat new blank project and test it? If it works well, then you should delete yuo sqlConection object, Adapter and dataset, and build it once again. But that is strange:)

With best wishes,
Alex

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top