By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Dynamically create sql tables with C#

Expert 100+
P: 210
I am working on a massive query that pulls a lots of data from the database and is being displayed in a gridview. I am trying to breakdown the query into multiple steps. To accomplish this i need to create temporary tables and use a join to get the data's more efficiently. My question is how do i create temp tables using a c# code.

Thank you in advance.
Jan 27 '09 #1
Share this Question
Share on Google+
4 Replies


Plater
Expert 5K+
P: 7,872
Temporary tables in SQL or just tables in C#?
DataTable dt = new DataTable(); will get you an empty datatable in C#
Jan 27 '09 #2

Expert 100+
P: 210
if i create table DataTable dt = new DataTable(); will i be able to perform sql join on the table with primary table and further retrieve the desired data only.

I am not sure but i think i need to create temporary table in SQL to perform the joins.
Jan 27 '09 #3

Plater
Expert 5K+
P: 7,872
Well if your joins are written in SQL, then you would need to create the temp table in the sql server.
Jan 27 '09 #4

100+
P: 344
You may create the table then drop it.
Jan 29 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.