Click here to Skip to main content
15,909,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get Data from a database.

I need to divide it into 2 tables according to int value 1 or 0.
That means all 1 field value comes 1st table and all 0 field value comes 2nd table [asp.net]

Anyone have any ideas?
Please share them with me

[edit] changed 'divided' to 'divide' [/edit]
Posted
Updated 8-Mar-11 21:54pm
v3
Comments
Albin Abel 9-Mar-11 3:06am    
supposed to be a insert query with select sub query using a where clause for 1 and then 0
Sourov007 9-Mar-11 3:30am    
Already I get table with data from database

Now I need to divided it into 2 table accordingly 0 or 1

So what I can do ??

thanks
Dalek Dave 9-Mar-11 3:54am    
Edited for Grammar, Syntax and Readability.
Sourov007 9-Mar-11 4:09am    
how I can do that ?
Dalek Dave 9-Mar-11 4:31am    
Click on the 'Improve Question' link.
I edit some questions to enable those whose English is not as good as others can still get the gist of the question and provide an answer.

write stored procedure in which write two select queries
queries should be same except the where condition

select * from table where fieldvalue =1

select * from table where fieldvalue =0

use dataadapter.fill method to fill the dataset.

It will give you two tables with both queries returning data


hope this helps
 
Share this answer
 
Comments
Sourov007 9-Mar-11 5:08am    
thats not point

I get data in code behind

NO FROM CODE BEHIND I need to separate it into 2 table
Coding C# 9-Mar-11 6:49am    
this should help you

http://msdn.microsoft.com/en-us/library/det4aw50.aspx
you can try to create two view in view filter value from table.
 
Share this answer
 
Comments
Sourov007 9-Mar-11 5:09am    
How I can create 2 view filter

"I get data in code behind

NO FROM CODE BEHIND I need to separate it into 2 table"

How I can do that ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900