473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Binding Text Boxes to a Dataset

Hi there
I am new to VB.Net (formerly a Centura 'Gupta' programmer) and just trying to do a simple excercise out of the help to populate a couple of text fields on a form by using a parameterized query.
ie. Walkthrough 'Displaying Data in a Windows Form Using a Parameterized Query
Sounds simple but for some reason when I get to the step where you are supposed to 'Expand the (DataBindings) node, and for the Text property, expand DsAuthors1, expand authors, and select au_id from the drop-down list.
I don't have a drop down list?! It's empty
Please help me find what I'm missing here

I have the following on my form
OdbcDataAdapter with a simple select command 'SELECT MBR_SAID, MBR_SURNAME, MBR_ADDR1 FROM FHP_MBR WHERE (MBR_SAID = ?)
OdbcConnection (to an Access database
and a DataSet (dsMbr

The following code is for the button click
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
OdbcDataAdapter1.SelectCommand.Parameters("mbr_sai d").Value = dfnMbr_said.Tex
dsMbr.Clear(
OdbcDataAdapter1.Fill(dsMbr
End Su

So what am I missing here please? I know it's probably simple... I just need a jumpstart
How do I bind the results of this query to the appropriate fields
I am using the VB.Net Standard edition and have therefore had to export my Oracle tables into Access for the purpose of this excercise since I believe you need the full blown Enterprise edition of Visual Studio to connect to Oracle
Thanks
Marnie

Nov 20 '05 #1
3 3224
Hi,

To bind a textbox to a datasource. This will bind the CategoryName
field of a dataset ds to textbox2.

TextBox2.DataBindings.Add("Text", ds.Tables(0), "CategoryName")

To use the oracle data provider you need to add a reference to
system.data.oracleclient.dll.

http://msdn.microsoft.com/library/de...sctorTopic.asp

Ken
------------------

"Marnie" <an*******@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
Hi there,
I am new to VB.Net (formerly a Centura 'Gupta' programmer) and just trying
to do a simple excercise out of the help to populate a couple of text
fields on a form by using a parameterized query..
ie. Walkthrough 'Displaying Data in a Windows Form Using a Parameterized
Query'
Sounds simple but for some reason when I get to the step where you are
supposed to 'Expand the (DataBindings) node, and for the Text property,
expand DsAuthors1, expand authors, and select au_id from the drop-down
list.'
I don't have a drop down list?! It's empty.
Please help me find what I'm missing here!

I have the following on my form:
OdbcDataAdapter with a simple select command 'SELECT MBR_SAID,
MBR_SURNAME, MBR_ADDR1 FROM FHP_MBR WHERE (MBR_SAID = ?)'
OdbcConnection (to an Access database)
and a DataSet (dsMbr)

The following code is for the button click:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
OdbcDataAdapter1.SelectCommand.Parameters("mbr_sai d").Value =
dfnMbr_said.Text
dsMbr.Clear()
OdbcDataAdapter1.Fill(dsMbr)
End Sub

So what am I missing here please? I know it's probably simple... I just
need a jumpstart!
How do I bind the results of this query to the appropriate fields?
I am using the VB.Net Standard edition and have therefore had to export my
Oracle tables into Access for the purpose of this excercise since I
believe you need the full blown Enterprise edition of Visual Studio to
connect to Oracle.
Thanks,
Marnie.

Nov 20 '05 #2
Hi Ken
Thanks for your response

I did try using something similar to that ie

Protected Sub BindControls(
dfsMbr_Surname.DataBindings.Add(New Binding("Text", dsMbr, "mbr.mbr_surname")
End Su

Should that work too

Although I wasn't sure then where to call BindControls() from? Where are you suggesting to put the code
TextBox2.DataBindings.Add("Text", ds.Tables(0), "CategoryName"

Does Tables(0) select the first table (being the only one in my case) in the query

I thought that I was going to be able to do this by going through the properties of TextBox2 (in my case dfsMbr_Surname) as per the documentation. I assume the code you gave me is generated for you if you do it through the properties dialog
Still wondering why nothing appeared in the Data Bindings section of the datafield properties
Thanks
Marnie
----- Ken Tucker [MVP] wrote: ----

Hi

To bind a textbox to a datasource. This will bind the CategoryName
field of a dataset ds to textbox2

TextBox2.DataBindings.Add("Text", ds.Tables(0), "CategoryName"

To use the oracle data provider you need to add a reference to
system.data.oracleclient.dll

http://msdn.microsoft.com/library/de...ssctorTopic.as

Ke
-----------------

"Marnie" <an*******@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com..
Hi there
I am new to VB.Net (formerly a Centura 'Gupta' programmer) and just trying
to do a simple excercise out of the help to populate a couple of text
fields on a form by using a parameterized query.
ie. Walkthrough 'Displaying Data in a Windows Form Using a Parameterized
Query
Sounds simple but for some reason when I get to the step where you are
supposed to 'Expand the (DataBindings) node, and for the Text property,
expand DsAuthors1, expand authors, and select au_id from the drop-down
list.
I don't have a drop down list?! It's empty
Please help me find what I'm missing here
I have the following on my form

OdbcDataAdapter with a simple select command 'SELECT MBR_SAID,
MBR_SURNAME, MBR_ADDR1 FROM FHP_MBR WHERE (MBR_SAID = ?)
OdbcConnection (to an Access database
and a DataSet (dsMbr
The following code is for the button click

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Clic
OdbcDataAdapter1.SelectCommand.Parameters("mbr_sai d").Value =
dfnMbr_said.Tex
dsMbr.Clear(
OdbcDataAdapter1.Fill(dsMbr
End Su
So what am I missing here please? I know it's probably simple... I just

need a jumpstart
How do I bind the results of this query to the appropriate fields
I am using the VB.Net Standard edition and have therefore had to export my
Oracle tables into Access for the purpose of this excercise since I
believe you need the full blown Enterprise edition of Visual Studio to
connect to Oracle
Thanks
Marnie

Nov 20 '05 #3
Hi,

It should. I dont think you need the mbr. Try this.

dfsMbr_Surname.DataBindings.Add(New Binding("Text", dsMbr, "mbr_surname"))

Ken
-------------------
"Marnie" <an*******@discussions.microsoft.com> wrote in message
news:B8**********************************@microsof t.com...
Hi Ken,
Thanks for your response.

I did try using something similar to that ie:

Protected Sub BindControls()
dfsMbr_Surname.DataBindings.Add(New Binding("Text", dsMbr,
"mbr.mbr_surname"))
End Sub

Should that work too?

Although I wasn't sure then where to call BindControls() from? Where are
you suggesting to put the code:
TextBox2.DataBindings.Add("Text", ds.Tables(0), "CategoryName")

Does Tables(0) select the first table (being the only one in my case) in
the query?

I thought that I was going to be able to do this by going through the
properties of TextBox2 (in my case dfsMbr_Surname) as per the
documentation. I assume the code you gave me is generated for you if you
do it through the properties dialog?
Still wondering why nothing appeared in the Data Bindings section of the
datafield properties?
Thanks,
Marnie.

----- Ken Tucker [MVP] wrote: -----

Hi,

To bind a textbox to a datasource. This will bind the
CategoryName
field of a dataset ds to textbox2.

TextBox2.DataBindings.Add("Text", ds.Tables(0),
"CategoryName")

To use the oracle data provider you need to add a reference to
system.data.oracleclient.dll.
http://msdn.microsoft.com/library/de...sctorTopic.asp

Ken
------------------

"Marnie" <an*******@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
> Hi there,
> I am new to VB.Net (formerly a Centura 'Gupta' programmer) and just

trying
> to do a simple excercise out of the help to populate a couple of

text
> fields on a form by using a parameterized query..
> ie. Walkthrough 'Displaying Data in a Windows Form Using a

Parameterized
> Query'
> Sounds simple but for some reason when I get to the step where you

are
> supposed to 'Expand the (DataBindings) node, and for the Text

property,
> expand DsAuthors1, expand authors, and select au_id from the

drop-down
> list.'
> I don't have a drop down list?! It's empty.
> Please help me find what I'm missing here!
>> I have the following on my form:

> OdbcDataAdapter with a simple select command 'SELECT MBR_SAID,
> MBR_SURNAME, MBR_ADDR1 FROM FHP_MBR WHERE (MBR_SAID = ?)'
> OdbcConnection (to an Access database)
> and a DataSet (dsMbr)
>> The following code is for the button click:

> Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e

As
> System.EventArgs) Handles Button1.Click
> OdbcDataAdapter1.SelectCommand.Parameters("mbr_sai d").Value =
> dfnMbr_said.Text
> dsMbr.Clear()
> OdbcDataAdapter1.Fill(dsMbr)
> End Sub
>> So what am I missing here please? I know it's probably simple... I

just
> need a jumpstart!
> How do I bind the results of this query to the appropriate fields?
> I am using the VB.Net Standard edition and have therefore had to

export my
> Oracle tables into Access for the purpose of this excercise since I
> believe you need the full blown Enterprise edition of Visual Studio

to
> connect to Oracle.
> Thanks,
> Marnie.
>

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RPI_alum | last post by:
I've been experiencing some frustrating behavior that I believe may be a MS bug in the Framework. Has anyone else experienced this, know a better way to resolve it, or if it is an actual MS bug ...
3
by: Lloyd Sheen | last post by:
I am having trouble with an app that does the following: 1. Query SQL Server and return one row 2. Bind the columns to text boxes 3. User updates info 4. User clicks update button ...
0
by: Marty U. | last post by:
I am building a 3 level deep heirarchy tree for an application requirement. I need the ability at any level to add an item to the tree. However, when something is added all 3 levels must be...
0
by: Lance Geeck | last post by:
Hi, I am trying to learn the VB.NET approach and am having problems with updating the database. What I have is a simple windows form using text boxes for entering name, address and phone. It is...
2
by: Rodney Lane | last post by:
Hi, I am using an oledb data adapter to connect to an MSAccess 2003 database. I use bindings on my windows forms to bind fields to the controls and for text boxes and grids it has been fine. ...
19
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this...
10
by: Richard | last post by:
I have created a form which sets up a dataview. The form views one record at a time using a currencymanager. This works fine. All my text boxes bind. However I have a combo box which gets its...
3
by: Max | last post by:
Hello, I made a windows form with a combo box and 4 text boxes. All 5 objects should get their data from a data set which is populated in the form load method. The combo box has item ids. When...
0
by: Dawnyy | last post by:
I have a form which is bound to a dataset. I am filling the forms dataset on Form_Load event. On my form I have combo boxes which I am setting by running a stored procedure to return a datatable,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.