Home All Groups Group Topic Archive Search About

container for tables & queries in VB.NET 2008

Author
29 Mar 2010 2:48 PM
Mr. X.
Hello.
Is there any container on VB.NET 2008, so I can drop queries & tables
objects on it?

Thanks :)

Author
30 Mar 2010 3:05 PM
Rich P
Try a Dataset.  You can select it from the Add menu under "Dataset"
(.xsd file) or create it in code

Dim ds As New Dataset

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Author
30 Mar 2010 4:59 PM
Mr. X.
Can I drop mySqlConnection or other connection objects to such a container,
or similar ?

Thanks :)

Show quoteHide quote
"Rich P" <rpng***@aol.com> wrote in message
news:uBa63pB0KHA.2512@TK2MSFTNGP05.phx.gbl...
> Try a Dataset.  You can select it from the Add menu under "Dataset"
> (.xsd file) or create it in code
>
> Dim ds As New Dataset
>
> Rich
>
> *** Sent via Developersdex http://www.developersdex.com ***
Author
30 Mar 2010 6:47 PM
Rich P
I you select a Dataset (.xsd) from the Add menu, then in the Server
Explorer (View menu) you can connect to whichever database and drag a
table or tables into the Dataset window.  I think another option to
right-click in the Dataset window and select Add TableDataAdapter which
will bring up a wizard that you can click through.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Author
31 Mar 2010 8:54 AM
Mr. X.
What I see is only few components I can drop on dataset.
TableAdapter, Query, DataTable, Relation.
I didn't see a way dropping connection.
(The specified connection is : mySqlConnection).

I want to drop the connection on design time.
Can I see more elements than the above four.

Thanks :)

Show quoteHide quote
"Rich P" <rpng***@aol.com> wrote in message
news:#7pE5lD0KHA.1796@TK2MSFTNGP02.phx.gbl...
> I you select a Dataset (.xsd) from the Add menu, then in the Server
> Explorer (View menu) you can connect to whichever database and drag a
> table or tables into the Dataset window.  I think another option to
> right-click in the Dataset window and select Add TableDataAdapter which
> will bring up a wizard that you can click through.
>
> Rich
>
> *** Sent via Developersdex http://www.developersdex.com ***
Author
31 Mar 2010 10:28 AM
Armin Zingler
Am 31.03.2010 10:54, schrieb Mr. X.:
> What I see is only few components I can drop on dataset.
> TableAdapter, Query, DataTable, Relation.
> I didn't see a way dropping connection.
> (The specified connection is : mySqlConnection).
>
> I want to drop the connection on design time.
> Can I see more elements than the above four.

You could drop several things on a Form - but what are you trying to do?


--
Armin
Author
31 Mar 2010 4:21 PM
Mr. X.
I want to drop elements on a dataset.
As far as I remember, Delphi IDE, i.e , has dataset, which I can drop also a
connections on it.
I don't understand why connections and other elements cannot be dropped to
dataset
(Or should I declare the connection somehow on the toolbox).

Thanks :)

Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:eJ5yhFM0KHA.220@TK2MSFTNGP06.phx.gbl...
> Am 31.03.2010 10:54, schrieb Mr. X.:
>> What I see is only few components I can drop on dataset.
>> TableAdapter, Query, DataTable, Relation.
>> I didn't see a way dropping connection.
>> (The specified connection is : mySqlConnection).
>>
>> I want to drop the connection on design time.
>> Can I see more elements than the above four.
>
> You could drop several things on a Form - but what are you trying to do?
>
>
> --
> Armin
Author
31 Mar 2010 4:52 PM
Patrice
Hello

> I want to drop elements on a dataset.

If you want to work with Datasets try :
http://msdn.microsoft.com/en-us/library/ms171897(VS.80).aspx

(Walkthrough: Creating a Dataset with the Dataset Designer ).

My personal preference is using Linq To Entity Framework
(http://msdn.microsoft.com/en-us/library/bb399247(v=VS.90).aspx)...

--
Patrice
Author
31 Mar 2010 4:54 PM
Armin Zingler
Am 31.03.2010 18:21, schrieb Mr. X.:
> I want to drop elements on a dataset.
> As far as I remember, Delphi IDE, i.e , has dataset, which I can drop also a
> connections on it.
> I don't understand why connections and other elements cannot be dropped to
> dataset
> (Or should I declare the connection somehow on the toolbox).

Connections are not part of a DataSet. A Dataset is a container for
DataTables (containing datarows) and DataRelations.

Documentation on Datasets:
http://msdn.microsoft.com/en-us/library/ss7fbaez.aspx

--
Armin
Author
31 Mar 2010 7:37 PM
Mr. X.
(Now I see that your email is nospam too).   :)

I see that on windows-form I can drop mySqlConnection object (under
toolbox -> dataset -> mySqlConnection).
Other objects are not seen on toolbox -> dataset, when windows-form is
active.
On dataset - the other objects I have mentioned are visible (except
mySqlConnection).

It is no obvious, since I want a visual tool that is dedicated to databases.

Is there any other visual tool I can drop mySqlConnection.
If not - where it is preferred to be dropped to.

Thanks :)

Show quoteHide quote
"Armin Zingler" <az.nospam@freenet.de> wrote in message
news:uyFNbMP0KHA.348@TK2MSFTNGP02.phx.gbl...
> Am 31.03.2010 18:21, schrieb Mr. X.:
>> I want to drop elements on a dataset.
>> As far as I remember, Delphi IDE, i.e , has dataset, which I can drop
>> also a
>> connections on it.
>> I don't understand why connections and other elements cannot be dropped
>> to
>> dataset
>> (Or should I declare the connection somehow on the toolbox).
>
> Connections are not part of a DataSet. A Dataset is a container for
> DataTables (containing datarows) and DataRelations.
>
> Documentation on Datasets:
> http://msdn.microsoft.com/en-us/library/ss7fbaez.aspx
>
> --
> Armin
Author
31 Mar 2010 8:47 PM
Mr. X.
When I put on the dataset a query - It should be referred to a connection,
and it is build with a wizard.
But what if I want to refer to an existing connection object (the connection
is known before using the query on the dataset), or know what is behind the
query and resolve the connection object from it ?

Thanks :)

Show quoteHide quote
"Mr. X." <nospam@nospam_please.com> wrote in message
news:#xBgwmQ0KHA.3708@TK2MSFTNGP02.phx.gbl...
> (Now I see that your email is nospam too).   :)
>
> I see that on windows-form I can drop mySqlConnection object (under
> toolbox -> dataset -> mySqlConnection).
> Other objects are not seen on toolbox -> dataset, when windows-form is
> active.
> On dataset - the other objects I have mentioned are visible (except
> mySqlConnection).
>
> It is no obvious, since I want a visual tool that is dedicated to
> databases.
>
> Is there any other visual tool I can drop mySqlConnection.
> If not - where it is preferred to be dropped to.
>
> Thanks :)
>
> "Armin Zingler" <az.nospam@freenet.de> wrote in message
> news:uyFNbMP0KHA.348@TK2MSFTNGP02.phx.gbl...
>> Am 31.03.2010 18:21, schrieb Mr. X.:
>>> I want to drop elements on a dataset.
>>> As far as I remember, Delphi IDE, i.e , has dataset, which I can drop
>>> also a
>>> connections on it.
>>> I don't understand why connections and other elements cannot be dropped
>>> to
>>> dataset
>>> (Or should I declare the connection somehow on the toolbox).
>>
>> Connections are not part of a DataSet. A Dataset is a container for
>> DataTables (containing datarows) and DataRelations.
>>
>> Documentation on Datasets:
>> http://msdn.microsoft.com/en-us/library/ss7fbaez.aspx
>>
>> --
>> Armin
>
Author
31 Mar 2010 10:36 PM
Cor Ligthert[MVP]
If you start for the first time there is no existing connection.

The second time you can select them from the dropdown which is placed left.


Show quoteHide quote
"Mr. X." <nospam@nospam_please.com> wrote in message
news:#NcFbNR0KHA.5344@TK2MSFTNGP02.phx.gbl...
> When I put on the dataset a query - It should be referred to a connection,
> and it is build with a wizard.
> But what if I want to refer to an existing connection object (the
> connection is known before using the query on the dataset), or know what
> is behind the query and resolve the connection object from it ?
>
> Thanks :)
>
> "Mr. X." <nospam@nospam_please.com> wrote in message
> news:#xBgwmQ0KHA.3708@TK2MSFTNGP02.phx.gbl...
>> (Now I see that your email is nospam too).   :)
>>
>> I see that on windows-form I can drop mySqlConnection object (under
>> toolbox -> dataset -> mySqlConnection).
>> Other objects are not seen on toolbox -> dataset, when windows-form is
>> active.
>> On dataset - the other objects I have mentioned are visible (except
>> mySqlConnection).
>>
>> It is no obvious, since I want a visual tool that is dedicated to
>> databases.
>>
>> Is there any other visual tool I can drop mySqlConnection.
>> If not - where it is preferred to be dropped to.
>>
>> Thanks :)
>>
>> "Armin Zingler" <az.nospam@freenet.de> wrote in message
>> news:uyFNbMP0KHA.348@TK2MSFTNGP02.phx.gbl...
>>> Am 31.03.2010 18:21, schrieb Mr. X.:
>>>> I want to drop elements on a dataset.
>>>> As far as I remember, Delphi IDE, i.e , has dataset, which I can drop
>>>> also a
>>>> connections on it.
>>>> I don't understand why connections and other elements cannot be dropped
>>>> to
>>>> dataset
>>>> (Or should I declare the connection somehow on the toolbox).
>>>
>>> Connections are not part of a DataSet. A Dataset is a container for
>>> DataTables (containing datarows) and DataRelations.
>>>
>>> Documentation on Datasets:
>>> http://msdn.microsoft.com/en-us/library/ss7fbaez.aspx
>>>
>>> --
>>> Armin
>>
Author
5 Apr 2010 3:36 PM
Mr. X.
I have solved the problem, by doing some code, and not using/ the IDE.
IDE was good for fast table creation (on dataset).
(For some things, it was better using some code behind).

The following example (by datagridview.datasouce) was just fine, and I have
learned by it using dataadapter
(Also good for insert, update, delete).
It binds on runtime, and not on the design time the connection.


Public Class Form1
    Inherits System.Windows.Forms.Form

    Private WithEvents dataGridView1 As New DataGridView()
    Private bindingSource1 As New BindingSource()

    Public Sub New()

        Me.dataGridView1.Dock = DockStyle.Fill
        Me.Controls.Add(Me.dataGridView1)
        InitializeDataGridView()

    End Sub

    Private Sub InitializeDataGridView()
        Try
            ' Set up the DataGridView.
            With Me.dataGridView1
                ' Automatically generate the DataGridView columns.
                .AutoGenerateColumns = True

                ' Set up the data source.
                bindingSource1.DataSource = GetData("Select * From
Products")
                .DataSource = bindingSource1

                ' Automatically resize the visible rows.
                .AutoSizeRowsMode = _
                    DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders

                ' Set the DataGridView control's border.
                .BorderStyle = BorderStyle.Fixed3D

                ' Put the cells in edit mode when user enters them.
                .EditMode = DataGridViewEditMode.EditOnEnter
            End With
        Catch ex As SqlException
            MessageBox.Show("To run this sample replace " _
                & "connection.ConnectionString with a valid connection
string" _
                & "  to a Northwind database accessible to your system.", _
                "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            System.Threading.Thread.CurrentThread.Abort()
        End Try
    End Sub

    Private Shared Function GetData(ByVal sqlCommand As String) _
        As DataTable

        Dim connectionString As String = _
            "Integrated Security=SSPI;Persist Security Info=False;" _
            & "Initial Catalog=Northwind;Data Source=localhost"

        Dim northwindConnection As SqlConnection = _
            New SqlConnection(connectionString)

        Dim command As New SqlCommand(sqlCommand, northwindConnection)
        Dim adapter As SqlDataAdapter = New SqlDataAdapter()
        adapter.SelectCommand = command

        Dim table As New DataTable
        table.Locale = System.Globalization.CultureInfo.InvariantCulture
        adapter.Fill(table)

        Return table

    End Function

    <STAThreadAttribute()> _
    Public Shared Sub Main()
        Application.Run(New Form1)
    End Sub

End Class

....


Thanks :)