Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have name of database. Let's name of database is db1.

I want to assign this database name to Database type/

Like : Database dt1 = db1;

It's showing error that string can not be assigned to database type.

What I have tried:

After assigning of database name to Database type i want to iterate that database.
Posted
Updated 20-Dec-17 23:47pm
v2
Comments
________________ 21-Dec-17 4:36am    
"Database type" - have another meaning. It is not linked to .NET type string.
You question shows that your not ready to "iterate" in Database.
Sorry.
Try to find in google something "How to connect to DB and read the table".
Sure you will find many step-by step videos.
Regards!
Member 13548480 21-Dec-17 5:14am    
I have created connection and i am able to list all database present in particular sql server.
Dave Kreskowiak 21-Dec-17 10:45am    
Yeah, but did you copy and paste the code from somewhere or do you REALLY understand how it works?
Member 13548480 21-Dec-17 12:26pm    
I understand code also.
an0ther1 21-Dec-17 16:15pm    
To reply to a comment, click the Reply button next to their name, otherwise they are not notified.
The database provider determines how you get lists of the database objects. For instance in SQL you query sys.tables to get a list of the tables - NOTE: You must be either the table owner or have permissions to see a table for it to be listed.
Google will help identifying how to get a list of tables in a database - for instance; https://www.google.com.au/search?q=sql+list+tables+in+database&oq=sql+determine+tables+in+&aqs

Kind Regards

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