Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All , Can some one tell me how retrieve database structure in dataset with primary key columns or get the columns that not allow nulls
thanx...
Posted
Comments
OriginalGriff 23-Apr-11 7:18am    
Can someone tell me what you are talking about? The two possibilities do not seem to relate to each other...
Prasanta_Prince 23-Apr-11 9:40am    
Its good to know the solution is worked for you.

Using DataReader you can do it. Here is the Code,-

scmd=new SqlCommand("select * from AdminUser",scon);
            scon.Open();

        sdr = scmd.ExecuteReader(CommandBehavior.KeyInfo);
        sdr.Read();
        dt = sdr.GetSchemaTable();
        scon.Close();


hope This can help you.
 
Share this answer
 
You can always add a constraint to a table in a dataset. See here[^].
 
Share this answer
 

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