Good afternoon everyone:
I am developing an application in C # with SQLServer2005. In one of the user controls that I use to display data from different queries in one gridcontrol. When I make the first query and update the datasourse loads fine but when I do the second one shows the number of columns for the first consultation.
What can I do to fix this problem?:confused:
Display data from different queries in one gridcontrol
Started by lemus, Sep 10 2009 10:30 AM
1 reply to this topic
#1
Posted 10 September 2009 - 10:30 AM
|
|
|
#2
Posted 11 September 2009 - 10:03 AM
This probably has to do with the scope of where your data scources are defined. I can't be sure though without seeing some code. I would put each of the queries into its own try block and define the data scource and update the datagridview within the try block so that the code will automatically do garbage collection at the end of the block but there are many different ways to make this work depending on your needs. You should simply be able to set the DataGridView.DataScource to a new table and it should update all of the needed properties. You may need to set the DataGridView.AutoGenerateColumns to true but I am not thinking that this is what is causing the problem.
P.S.--I just asumed you where using a datagridview....Which control are you using? There are different properties for the different ones so It makes it a bit hard to guess without knowing what you are using. If you could post a bit of the code it would help out tremendously;)
P.S.--I just asumed you where using a datagridview....Which control are you using? There are different properties for the different ones so It makes it a bit hard to guess without knowing what you are using. If you could post a bit of the code it would help out tremendously;)


Sign In
Create Account

Back to top









