I am working in sql server2005 and c# I have five database in my project and I want to display one table from each database in one datagridview. How can i do it.

Recommended Answers

All 6 Replies

Are your column names in all dataBases the same? If they are, you can use dataBinding. Otherwise you will have to populate DGV manually. How? 1st you need to have the same number of columns or less (NOT more)! Then simply loop through each dataTable (each will be filled from the dataBase, using sqlDataAdapter), and through each row of dataTable. This is it!

All column name are same in all database.but the problem is I dont know how many database in sql because data base is creating at run time. which condition I have to use to do this.

1st of all, I know its not my business, but why do you create dataBases (or/and their dataTables) in the run time? Why its one not good enought?
There is no point of having more dataBase with the same sintax. You could have only one, and populate it (and getting data out too - like you want to do now).

Its sounds so strange to me, to have planty of equal dataBases.
You might reconsider of re-edit your dataBase - to create only one. And work with only one for ever.

What do you think of that?

I am sorry.
I know that its good to work in only one database but if their is thousand of transaction are perform in one database then I think it make some problems. And database table and content are same but the data in each database and tables are always different.

u tell me if one database is capable to hold large amount of data then i will work one database.

May be i am wrong. but you are sinner to me you have lost of knowledge and experience that me. I am new in the sql and c#.

I dont know exactly what you are doing, but one dataBase should do with thousand of transactions, but the question is, what is the period? 1000 in one second? that shouldnt be a probelm these day. Read here for some info.
But I doubt you are creating a professional application for some bank or a huge company, that has that many transactions.

So I believe you can handle with one dataBase only.
What is your answer on that?

I read that artical. thank u for providing the link. I was making it so hard.
thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.