Hi,
I'm trying to fill a combobox with values from a sql table. Data
seems to be connected fine. Apparently in VB Express sqlDataAdapter
doesn't work, or at least I can't make it work. Searching the help
information, it directed me to Table Adapters instead.
Can anybody help me with correcting this code. It doesn't like the
sql statement at the end of table adapters declaration line. How do I
get a sql statement to populate table values so that I can direct them
to the combobox?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PublishersTableAdapter.Fill(Me.PUBSDataSet.publ ishers)
Dim PubsDS As New PUBSDataSet()
Dim PubsTA As New
PUBSDataSetTableAdapters.publishersTableAdapter()= ("SELECT * FROM
publishers")
PubsTA.Fill(PubsDS.publishers)
cboPubID.DataSource = PubsDS
cboPubID.ValueMember = "pub_id"
cboPubID.DisplayMember = "pub_name"
Thanks,
Randy 6 3579
table adapters are unnecessary
ADO.net is hogwash
stick with ADO classic, write data in HTML and don't follow the trendy
'programming language of the month' paradigm
On Apr 5, 8:35 am, "Randy" <spam.eastl...@gmail.comwrote:
Hi,
I'm trying to fill a combobox with values from a sql table. Data
seems to be connected fine. Apparently in VB Express sqlDataAdapter
doesn't work, or at least I can't make it work. Searching the help
information, it directed me to Table Adapters instead.
Can anybody help me with correcting this code. It doesn't like the
sql statement at the end of table adapters declaration line. How do I
get a sql statement to populate table values so that I can direct them
to the combobox?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PublishersTableAdapter.Fill(Me.PUBSDataSet.publ ishers)
Dim PubsDS As New PUBSDataSet()
Dim PubsTA As New
PUBSDataSetTableAdapters.publishersTableAdapter()= ("SELECT * FROM
publishers")
PubsTA.Fill(PubsDS.publishers)
cboPubID.DataSource = PubsDS
cboPubID.ValueMember = "pub_id"
cboPubID.DisplayMember = "pub_name"
Thanks,
Randy
Ignore AaronKempf; he's a troll.
Robin S.
-----------------------------
"Randy" <sp***********@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
Hi,
I'm trying to fill a combobox with values from a sql table. Data
seems to be connected fine. Apparently in VB Express sqlDataAdapter
doesn't work, or at least I can't make it work. Searching the help
information, it directed me to Table Adapters instead.
Can anybody help me with correcting this code. It doesn't like the
sql statement at the end of table adapters declaration line. How do I
get a sql statement to populate table values so that I can direct them
to the combobox?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PublishersTableAdapter.Fill(Me.PUBSDataSet.publ ishers)
Dim PubsDS As New PUBSDataSet()
Dim PubsTA As New
PUBSDataSetTableAdapters.publishersTableAdapter()= ("SELECT * FROM
publishers")
PubsTA.Fill(PubsDS.publishers)
cboPubID.DataSource = PubsDS
cboPubID.ValueMember = "pub_id"
cboPubID.DisplayMember = "pub_name"
Thanks,
Randy
I am not a troll
I just speak for truth
Jihad against Microsoft; not all change is good
not all change is trendy
I won't change languages 'just because it's trendy thing to do'
On Apr 5, 11:00 pm, "RobinS" <Rob...@NoSpam.yah.nonewrote:
Ignore AaronKempf; he's a troll.
Robin S.
-----------------------------"Randy" <spam.eastl...@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
Hi,
I'm trying to fill a combobox with values from a sql table. Data
seems to be connected fine. Apparently in VB Express sqlDataAdapter
doesn't work, or at least I can't make it work. Searching the help
information, it directed me to Table Adapters instead.
Can anybody help me with correcting this code. It doesn't like the
sql statement at the end of table adapters declaration line. How do I
get a sql statement to populate table values so that I can direct them
to the combobox?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PublishersTableAdapter.Fill(Me.PUBSDataSet.publ ishers)
Dim PubsDS As New PUBSDataSet()
Dim PubsTA As New
PUBSDataSetTableAdapters.publishersTableAdapter()= ("SELECT * FROM
publishers")
PubsTA.Fill(PubsDS.publishers)
cboPubID.DataSource = PubsDS
cboPubID.ValueMember = "pub_id"
cboPubID.DisplayMember = "pub_name"
Thanks,
Randy- Hide quoted text -
- Show quoted text -
Table adapters are used with strongly typed datasets. You design these
through the Data Designer. That doesn't seem like what you are doing. It
sounds like you just want to read the database, get a table of data, and
bind it to your combobox. Is that right?
If so, try something like this:
Dim dt as DataTable
Using cn as New SqlConnection(myConnectionString)
cn.Open()
'Define the SQL Command object
Dim cmd As SqlCommand = New SqlCommand()
cmd.Connection = cn
cmd.ComandType = CommandType.Text
cmd.CommandText = ""SELECT * FROM publishers"
Dim da As SqlDataAdapter = new SqlDataAdapter(cmd)
dt = New DataTable()
da.Fill(dt)
End Using 'This closes the connection
cboPubID.DataSource = dt
cboPubID.ValueMember = "pub_id"
cboPubID.DisplayMember = "pub_name"
Robin S.
----------------------
"Randy" <sp***********@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
Hi,
I'm trying to fill a combobox with values from a sql table. Data
seems to be connected fine. Apparently in VB Express sqlDataAdapter
doesn't work, or at least I can't make it work. Searching the help
information, it directed me to Table Adapters instead.
Can anybody help me with correcting this code. It doesn't like the
sql statement at the end of table adapters declaration line. How do I
get a sql statement to populate table values so that I can direct them
to the combobox?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PublishersTableAdapter.Fill(Me.PUBSDataSet.publ ishers)
Dim PubsDS As New PUBSDataSet()
Dim PubsTA As New
PUBSDataSetTableAdapters.publishersTableAdapter()= ("SELECT * FROM
publishers")
PubsTA.Fill(PubsDS.publishers)
cboPubID.DataSource = PubsDS
cboPubID.ValueMember = "pub_id"
cboPubID.DisplayMember = "pub_name"
Thanks,
Randy
wow... that is funny
do you know how many lines of code it takes me to build a databound
combo box?
UH ZERO?
On Apr 7, 12:33 am, "RobinS" <Rob...@NoSpam.yah.nonewrote:
Table adapters are used with strongly typed datasets. You design these
through the Data Designer. That doesn't seem like what you are doing. It
sounds like you just want to read the database, get a table of data, and
bind it to your combobox. Is that right?
If so, try something like this:
Dim dt as DataTable
Using cn as New SqlConnection(myConnectionString)
cn.Open()
'Define the SQL Command object
Dim cmd As SqlCommand = New SqlCommand()
cmd.Connection = cn
cmd.ComandType = CommandType.Text
cmd.CommandText = ""SELECT * FROM publishers"
Dim da As SqlDataAdapter = new SqlDataAdapter(cmd)
dt = New DataTable()
da.Fill(dt)
End Using 'This closes the connection
cboPubID.DataSource = dt
cboPubID.ValueMember = "pub_id"
cboPubID.DisplayMember = "pub_name"
Robin S.
----------------------"Randy" <spam.eastl...@gmail.comwrote in message
news:11**********************@w1g2000hsg.googlegro ups.com...
Hi,
I'm trying to fill a combobox with values from a sql table. Data
seems to be connected fine. Apparently in VB Express sqlDataAdapter
doesn't work, or at least I can't make it work. Searching the help
information, it directed me to Table Adapters instead.
Can anybody help me with correcting this code. It doesn't like the
sql statement at the end of table adapters declaration line. How do I
get a sql statement to populate table values so that I can direct them
to the combobox?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PublishersTableAdapter.Fill(Me.PUBSDataSet.publ ishers)
Dim PubsDS As New PUBSDataSet()
Dim PubsTA As New
PUBSDataSetTableAdapters.publishersTableAdapter()= ("SELECT * FROM
publishers")
PubsTA.Fill(PubsDS.publishers)
cboPubID.DataSource = PubsDS
cboPubID.ValueMember = "pub_id"
cboPubID.DisplayMember = "pub_name"
Thanks,
Randy
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Programatix |
last post by:
Hi,
Have anyone ever benchmark the TableAdapter performance compared to
DataTable's Load method? I found out that the DataTable's Load method is
about 10x faster than TableAdapter's Fill method....
|
by: Mike |
last post by:
Dear Group,
When I add a DataTable to a Typed Dataset, and a TableAdapter to the
DataTable, I am able to create methods to send updates directly to the
database (GenerateDBDirectMethods),...
|
by: rpuertas |
last post by:
Hello,
Visual Web Developer 2005 Express Edition and SQL Server 2005 Express: I
want to run a paged query within a TableAdapter. In the TableAdapter Query
Configuration Wizard" I write the next...
|
by: matthewtec |
last post by:
I realize there are probably many discussions on these two... whether to get
now or wait or yadda yadda yadda.
My question is that I can continuing training on visual studio.net 2003, and...
|
by: Demetri |
last post by:
I have a question / concern regarding the new suggested way of creating a
data access layer in an n-tier application. Typically, a web application
specifically, using the SOA (Service Oriented...
| |
by: GaryDean |
last post by:
I'm comparing use of DataView -ObjectDataSource -TableAdapter to
DataView -SqlDataSource using the Customers table on the NorthWind
database.
The SQL given to both wizards is:
SELECT ...
|
by: googlegroups.dsbl |
last post by:
I'm really confused here, and am wondering if someone knows what could
be the issue with my TableAdapter query.
A few months ago, I created a really neat program that has th ability
to search by...
|
by: =?Utf-8?B?UmljaCBIdXRjaGlucw==?= |
last post by:
I'm not really sure how to ask this question because I'm still getting my
feet wet with data access and VB.NET, but here goes:
To start off with, I'm using VB 2005 Express to connect to an Access...
|
by: SAL |
last post by:
Hello,
Using the designer in my project, I created a DataTable for one of the
tables in an Access database. I created a TableAdapter for that DataTable by
adding queries. For the most part, the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |