Re: QueriesTableAdapter

Tech-Archive recommends: Fix windows errors by optimizing your registry



Using the wizards will restrict your objects considerably. You are
better off doing this in code as follows (I am using Windows
Authentication in this sample if you are using Sql Server):

--------------------------------------------
Imports System
Imports System.Data.SqlClient

Dim conn As SqlConnection, da As SqlDataAdapter
Dim ds As Dataset

Private Sub Form1_Load(...) Handles MyBase.Load
conn1 = New SqlConnection
conn1.ConnectionString = "Data Source=yourSvr;Initial
Catalog=yourDB;Integrated Security=True"

ds = New Dataset
da = New SqlDataAdapter
da.SelectCommand = New SqlCommand
da.SelectCommand.Connection = conn
da.SelectCommand = "Select * From yourTbl"
da.Fill(ds, "tblSteve")

datagridview1.DataSource = ds.Tables("tblSteve")
End Sub
----------------------------------------------

Just create a new form and drop a datagridview control on it. Then copy
and paste the code above into your new form. Replace yourTbl with the
name of an actual table on your server DB. Now load the project and you
will see the data in your form's datagridview control.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
.



Relevant Pages

  • Re: QueriesTableAdapter
    ... Dim conn As SqlConnection, da As SqlDataAdapter ... Private Sub Form1_LoadHandles MyBase.Load ... Just create a new form and drop a datagridview control on it. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Adding additional SELECTs to dataadapter
    ... Dim da As SqlDataAdapter, conn As SqlConnection ... Private Sub Form1_LoadHandles MyBase.Load ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Datagridview not populating from stored proc with 2 parameters
    ... Private Sub FillDatagridview() ... Dim conn as sqlConnection, da As SqlDataAdapter, ds As Dataset ...
    (microsoft.public.dotnet.languages.vb)
  • Re: newby problem
    ... > Public Class Form1 ... > Private Sub Form1_Load(ByVal sender As System.Object, ... > Line should read Dim da As SqlDataAdapter = New SqlDataAdapter ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Neue Tabelle in Access estellen
    ... Mittels des SqlCommands einen SqlDataAdapter erstellen (wenn Du keine ... SqlConnection schliessen und andere SqlObjekte disposen (DataAdpater, ... Dim dbVerbindung As New SqlConnection ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)