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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which Data source to use? 2

Status
Not open for further replies.

whateveragain

Programmer
Apr 20, 2009
92
US
FormA has a gridview and a SQLDataSource control which refers to a dynamic table which was created in the screen prior to FormA. On FormA there is a button that leads to FormB, which allows restrictions to the table displayed in FormA. Currently I drop the table and try to recreate it, then re-call FormA, but the table will not re-create. It keeps displaying the previous table in FormA. The columns are the same, just the records change. What is the best way to do this? What am I doing wrong?
 
What am I doing wrong?
You are using the datasource controls.

Write the data access code yourself, in reusable code, that you can call from each page.

 
How do I write this line when the table name is dynamic?

com.CommandText = "Select * From @tmpselcond";
 
Store the data in a datatable object, and transfer that object between pages.
 
the command text can be whatever you want, so you could create and load the temp table, and then select from it
Code:
create table @temp (
  .....
);
insert into @temp
select ....

select * from @temp

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top