Results 1 to 15 of 15

Thread: [2005] Graphical tools for ADO.NET

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    12

    [2005] Graphical tools for ADO.NET

    Is there any graphical tool i can use to conect to a Database using ADO.NET?
    i've learn how to do it with code but i prefer using graphical tools if any.

    By the Way, Can anyone tell me how to work with querys in ADO.NET for manupulation of a Datatable

    any help will be apriciated

    Thank you
    __________________________________________________________________

    Visit my other threads please, i need help with a new proyect

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

    Re: [2005] Graphical tools for ADO.NET

    Select Data -> New Data Source (or something close to that) from the main menu. Follow the wizard and it will create a typed DataSet with TableAdapters for you. You can then edit that DataSet in the designer by adding TableAdapters/DataTables, queries and DataRelations or deiting the existing objects. You can also add a typed DataSet to your project directly and building it up from scratch, without creating a Data Source, but I really don't see the point. If you're going to create a typed DataSet then let the IDE do as much of the work for you as you can.
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    12

    Re: [2005] Graphical tools for ADO.NET

    thanks, now my proyect has a datasource, but how can i add, edit, delete data from here on?

    I know SQL, so if you could tell me a way to execute a query when you push a button it would be even better.


    by the way, can you tell me how to make a filter for the datatable linked to a datasource

    thanks

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Graphical tools for ADO.NET

    Try this intro to ADO.NET tutorial.

    http://vbforums.com/showthread.php?t=466658

    :
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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

    Re: [2005] Graphical tools for ADO.NET

    That tutorial is no use for VS 2005 Data Sources and typed DataSets Rob.

    Once you have created a Data Source and generated a typed DataSet you have a DataTable/TableAdapter pair for each table in your database. By default each TableAdapter has two ways to retrieve data: Fill to populate an existing DataTable and GetData to create and populate a new DataTable. Assuming that your DataSet is named MyDataSet and it contains a table named Person you would retrieve data like this:
    vb.net Code:
    1. Dim data As New MyDataSet
    2.  
    3. Using adapter As New MyDataSetTableAdapters.PersonTableAdapter
    4.     adapter.Fill(data.PersonTable)
    5. End Using
    or like this:
    vb.net Code:
    1. Dim table As PersonTable
    2.  
    3. Using adapter As New MyDataSetTableAdapters.PersonTableAdapter
    4.     table = adapter.GetData()
    5. End Using
    If you want to retrieve result sets that don't match a specific table in your database then you open the DataSet in the designer and add a new TableAdapter from the Toolbox. You then have the opportunity to configure the adapter via a wizard. You can enter the SQL query yourself or you can build it visually using the Query Wizard. Once the wizard completes a new DataTable/TableAdapter pair is added to your DataSet with the DataTable's schema matching that of your query's result set.

    For more information on configuring and using TableAdapters I suggest you take a look here.
    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

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] Graphical tools for ADO.NET

    No its not but like I posted its just an "intro" to ADO.NET
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    12

    Re: [2005] Graphical tools for ADO.NET

    i already have done that using the properties of the datatable, what i need to know is how can i manipulate the datatable using SQL code.


    Example, i want to execute a Query when i push a button. so this way i can edit, delete, add new data or even filter.

    this is what i need to do, please tell how can i do it

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

    Re: [2005] Graphical tools for ADO.NET

    The DataTable has NewRow and Rows.Add methods for creating and adding new rows. Each DataRow has a Delete method. To edit a row you just set the Item property indexed by column name or number. You can't filter or sort a DataTable directly but you it has a DefaultView property that is type DataView. The DataView class provides a view of the data in a DataTable and has RowFilter and Sort properties.

    Generally in VB 2005 you will simply bind your DataTable to a BindingSource and then bind that to your control(s). You then do all your data manipulation and navigation via the BindingSource. It provides properties and methods to filter and sort the data plus methods add new rows. You can also access individual rows via the Current or Item properties, which you can then edit or delete. It also provides navigation methods, like MoveNext and MovePrevious. I strongly suggest that you go to the MSDN library and read the documentation for the BindingSource class.
    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

  9. #9

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    12

    Re: [2005] Graphical tools for ADO.NET

    thanks for everything!

    now i know how to do most things : add new, delete, and filter.
    but i didn't understand how edit.

    could you give an example please.
    P.D.: i'm using

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

    Re: [2005] Graphical tools for ADO.NET

    Each row is an object. To edit a row just set the appropriate property, just like any other object.
    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

  11. #11

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    12

    Re: [2005] Graphical tools for ADO.NET

    yes, but what property is it and how do i use it (sorry for been so dump, i just stared using vb 2005)

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

    Re: [2005] Graphical tools for ADO.NET

    Whatever the name is of the column you want to set, that's the name of the property. The whole point of typed DataSets is that the classes are tailored to your data, so the members available is different every time. You get the value and set it the same way you do any other property.

    The one thing to look out for is if your column can contain nulls. In that case you need to call the appropriate method to check for null first ro getting the property value will crash. You also use another method to set the field to null, e.g.
    vb.net Code:
    1. Dim myString As String
    2.  
    3. If myDataRow.IsMyColumnNull() Then
    4.     myString = Nothing
    5. Else
    6.     myString = myDataRow.MyColumn
    7. End If
    8.  
    9. '...
    10.  
    11. If myString Is Nothing Then
    12.     myDataRow.SetMyColumnNull()
    13. Else
    14.     myDataRow.MyColumn = myString
    15. End If
    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

  13. #13

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    12

    Re: [2005] Graphical tools for ADO.NET

    thanx for the code, it can avoid crashing. Something i did'nt understand was what is mystring in this case? The string i insert?

    Another thing is you never told me how to edit. I need to edit using data visualisation in a datagridview and textboxs, using the textbox to edit. both control are linked to the same bindingSource

    At the begining i though it was working, because it show the changes made with the texbox in the datagridview but when i close the form it is erased, this mean it doesn't modify any record on the database.

    Sorry if this causes you trouble but this is the first time making a somewhat serious program

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

    Re: [2005] Graphical tools for ADO.NET

    Did you follow the link I provided in post #5, or are you waiting for all the information to be provided here? That page has a link entitled "Saving Data", so it likely would be the place to look if your data is not saving. There's a wealth of information there so I suggest you start reading.
    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

  15. #15

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    12

    Re: [2005] Graphical tools for ADO.NET

    sorry, i dind'nt notice the link...
    and i dont expect you to tell me everything, i like investigating on my own too.

    Sorry you got the wrong image of me...

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