I am just FULL of SQL questions...
This is mainly an ADO.NET 2.0 question.
If you create a new dataset, then add a table ot it with a name and whatnot, can it automatically create the table with the columns, sizes, stipulations, etc in SQL server or would you need to do that in an SQLCommand?
Thanks for the help!
Re: I am just FULL of SQL questions...
No, it does not automaticaly do that. You would have to create the table yourself using a CREATE TABLE script.
-tg
Re: I am just FULL of SQL questions...
How do I programmatically, through VB.net 2k5, create a relationship? I have 2 tables, one with 3 fields. Thos fields' values are dependant on a few records from the 2nd table. If I update the values in the second table, is there a way to have it update the dependant fields from the first table?
Thanks.
Re: I am just FULL of SQL questions...
I cannot remember if it is video 8 or 9, but one of them does a good job of walking you through establishing relationships between two tables.
http://msdn.microsoft.com/vstudio/express/vb/learning/
Re: I am just FULL of SQL questions...
Is there a way to fill a dataset with the entire database?
Re: I am just FULL of SQL questions...
Quote:
Originally Posted by tacoman667
Is there a way to fill a dataset with the entire database?
The best way to do that would be to create a strongly-typed DataSet and then Fill from each TableAdapter. I haven't had the pleasure in 2.0 yet so I don't know all the ins and outs I'm afraid. I think you have to add a data source to your project, which creates a DataSet type that has the same schema as your database. You can then create instances of this DataSet and populate its tables using the automatically generated TableAdapters.
Re: I am just FULL of SQL questions...
Whew, that sounds like alot of work, especially considering that my database must stay as dynamic as possible. I wish I could just use the databinding objects generated by VS2k5 but I am constantly creating new databases and tables within that DB.
A question I just thought about, how would I go about presenting a list of all databases within the SQL server?
I was thinking of putting it on a treeview or listview for the user to click and open the DB.
Thanks for the help!
Re: I am just FULL of SQL questions...
AHA! I figured it out. You can write a SELECT statement to get the list.
[Highlight=VB]
SELECT * FROM sys.databases
[\VBCODE]