Link to home
Start Free TrialLog in
Avatar of dyarosh
dyarosh

asked on

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!
Avatar of teebon
teebon
Flag of Singapore image

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
as
begin
--- 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
end
DataSet1 ds = new DataSet1();

gv.DataSource = ds.Tables[0];
gv.DataBind();

Open in new window

Avatar of dyarosh
dyarosh

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Obadiah Christopher
Obadiah Christopher
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dyarosh

ASKER

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?