Results 1 to 8 of 8

Thread: I am just FULL of SQL questions...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    258

    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!
    Currently Using: VS 2005 Professional

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    258

    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.
    Currently Using: VS 2005 Professional

  4. #4
    Hyperactive Member nothingofvalue's Avatar
    Join Date
    Jul 2005
    Location
    Arizona
    Posts
    489

    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/
    "Imagination is more important than knowledge..."

    Albert Einstein
    -----------------------------------------------
    If my reply helped you then you really were lost, but I still took the time to help, please rate it anyway

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    258

    Re: I am just FULL of SQL questions...

    Is there a way to fill a dataset with the entire database?
    Currently Using: VS 2005 Professional

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    258

    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!
    Currently Using: VS 2005 Professional

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    May 2005
    Posts
    258

    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]
    Currently Using: VS 2005 Professional

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width