Re: QueriesTableAdapter
- From: Rich P <rpng123@xxxxxxx>
- Date: Mon, 03 Mar 2008 13:40:58 -0800
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 ***
.
- Follow-Ups:
- Re: QueriesTableAdapter
- From: Cor Ligthert[MVP]
- Re: QueriesTableAdapter
- References:
- QueriesTableAdapter
- From: peterg12345
- QueriesTableAdapter
- Prev by Date: Re: sending mail to my email
- Next by Date: DbProviderFactory
- Previous by thread: Re: QueriesTableAdapter
- Next by thread: Re: QueriesTableAdapter
- Index(es):
Relevant Pages
|