• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

ASP.NET and DataSets

I have a Classic ASP application that uses an MS SQL Server database.  I am going to migrate the ASP app to ASP.NET and make some enhancements.  I will be making some changes to the database tables for this enhancement.  

I created a new DataSet and added datatables manually to the DataSet to represent the changes I will be making for the enhancement.  (I can't change the database yet and don't want to wait to begin my development.)

What I need to do now is add a GridView to my form using data from a table in my newly created DataSet.  When I choose Object as my DataSource Type, it doesn't allow me to choose my new DataSet even though it exists in my App_Code folder.

My plan is to populate the new DataSet during the PageLoad Event as a temporary measure until I can make the database changes.

I am using VS 2010.  Any help would be greatly appreciated!
1 Solution
teebonProduct ManagerCommented:
Can you post the detailed error message for the DataSet issue you facing?
if you use database store procedure with dump/temporary data to return it will work
for e.g. if u use store procedure like usp_user
create proc usp_user
--- select userid, username, activedeactive from usertable
   select 23 , 'sampleuser23' , 1 union all
   select 53 , 'sampleuser53' , 1 union all
   select 26 , 'sampleuser26' , 1 union all
   select 73 , 'sampleuser73' , 0
Obadiah ChristopherCommented:
DataSet1 ds = new DataSet1();

gv.DataSource = ds.Tables[0];

Open in new window

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

dyaroshAuthor Commented:
I knew how to do it programmatically.  What I really want to be able to do is to do it in the IDE so I can format the gridview and set it up for editing.  

So maybe a better question is how can I create a DataSet that is not tied to a database.  If I have to I could create an XML file or Text file to simulate the database but I was hoping I could just define the tables in the DataSet and then programmatically populate the tables in the DataSet.  If the DataSet and tables existed in the IDE I would then use it to bind to different controls on my form and then once the database on my system can be changed I would modify my DataSet to be configured to my database.

Am I making more sense?
Obadiah ChristopherCommented:
I don't think you can bind a typed dataset to gridview in design time. You have to do it from server-side.

Alternatively I think you could just creat an XML file and bind the Gridview using a XMLDataSource. That way you can do it designtime.
dyaroshAuthor Commented:
So if I create an XML file and bind the Gridview using an XMLDataSource I should be able to format the Grid the way I want it to look and behave.  When I am finally able to make the changes to my SQL Database, do I just change my datasource on my DataSet if the tables are laid out the same?  Will I have to change anything with the Gridview processing?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now