473,320 Members | 2,088 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,320 software developers and data experts.

how to specify which row is to be displayed?

Hello:

I have a form which I would like to fill with data from one row of an ODBC
database table.

I have created the Table adapter and I have a query:

SELECT PATIENT.Name, PATIENT.address
FROM PATIENT
WHERE PatientID = ?

This gives me a GetDataBy(PatientID) method.

How can I then drag the controls onto the form and specify they be filled
with the row which is specified by PatientID?

There is also a Query that gets All Rows for a DataGridView in another form
which the drag and drop seems to default to such that I always get the first
row and not the row I specified programaticaly.

If I can't drag/drop then how do I change ordinary textboxes to be databound
by the GetDataBy(PatientID) query?

Thanks

Edwin
Feb 24 '07 #1
2 3746
On Feb 23, 7:04 pm, "Edwin Smith" <smithgold...@aol.comwrote:
Hello:

I have a form which I would like to fill with data from one row of an ODBC
database table.

I have created the Table adapter and I have a query:

SELECT PATIENT.Name, PATIENT.address
FROM PATIENT
WHERE PatientID = ?

This gives me a GetDataBy(PatientID) method.

How can I then drag the controls onto the form and specify they be filled
with the row which is specified by PatientID?

There is also a Query that gets All Rows for a DataGridView in another form
which the drag and drop seems to default to such that I always get the first
row and not the row I specified programaticaly.

If I can't drag/drop then how do I change ordinary textboxes to be databound
by the GetDataBy(PatientID) query?

Thanks

Edwin
Declare a DataSet. Fill the DataSet with data (use a
SqlDataAdapter). Bind a grid to the DataSet using gridView.DataSource
= myDataSet;. Add some text controls to your form. Set the data
binding properties to bind to your DataSet. The gridView control will
take care of the rest (i.e. the currencyManager).

myGridView.DataSource = myDataSet.Tables["Patient"];

txtPatientName.SetDataBinding (myDataSet.Tables["Patient"], "Name");
txtPatientAddress.SetDataBinding (myDataSet.Tables["Patient"],
"Address");

this should do it, every time you choose another patient in the grid,
the text controls will be updated appropriately.
Jon

Feb 24 '07 #2

<ma*****@gmail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
On Feb 23, 7:04 pm, "Edwin Smith" <smithgold...@aol.comwrote:
>Hello:

I have a form which I would like to fill with data from one row of an
ODBC
database table.

I have created the Table adapter and I have a query:

SELECT PATIENT.Name, PATIENT.address
FROM PATIENT
WHERE PatientID = ?

This gives me a GetDataBy(PatientID) method.

How can I then drag the controls onto the form and specify they be filled
with the row which is specified by PatientID?

There is also a Query that gets All Rows for a DataGridView in another
form
which the drag and drop seems to default to such that I always get the
first
row and not the row I specified programaticaly.

If I can't drag/drop then how do I change ordinary textboxes to be
databound
by the GetDataBy(PatientID) query?

Thanks

Edwin

Declare a DataSet. Fill the DataSet with data (use a
SqlDataAdapter). Bind a grid to the DataSet using gridView.DataSource
= myDataSet;. Add some text controls to your form. Set the data
binding properties to bind to your DataSet. The gridView control will
take care of the rest (i.e. the currencyManager).

myGridView.DataSource = myDataSet.Tables["Patient"];

txtPatientName.SetDataBinding (myDataSet.Tables["Patient"], "Name");
txtPatientAddress.SetDataBinding (myDataSet.Tables["Patient"],
"Address");

this should do it, every time you choose another patient in the grid,
the text controls will be updated appropriately.
Jon
I have that much pretty well working. It was when I went to the second form
is where I was having a problem.

I discovered that when I would drag a field to the form VS2005 would create
a navigator for me that I could type in a PatientID and click the button to
get the row of data.

I took part of the code it generated and modified it to plug in the
PatientID passed from the other form and it works fine now. I had to do that
for each table adapter of which there were about 12 to get all of the info
for that patient ID.

Here's one of the 12 lines of code to fetch the row of data:

this.pATIENTSTableAdapter.FillByPatientID(this.pat ients.PATIENTS,
Convert.ToInt32(this.Tag));

Thanks for your help.

Edwin
Feb 25 '07 #3

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

Similar topics

1
by: SW | last post by:
I have an ASP page that causes Excel to be loaded on the client PC with the text sent from within the page. An excerpt of it is shown below: With Response .ContentType =...
2
by: Matt | last post by:
I have a page1 that opens a window called page2. I want page2 doesn't have title bar, tool bar, address bar. Is it possible to specify in javascript function window_onload() in page2? I don't...
2
by: Jim Van Abbema | last post by:
Just beneath my row of navigation buttons, I am using rollovers to bring up different graphic images, each which have been mapped with several links. Of course, each graphic requires its own image...
1
by: Suresh | last post by:
Hi, Iam trying to build a GUI. I would like to know how do I specfiy the size of the Panel that is being displayed. The default some how seems to be set as 100 as height and 200 as the width. But...
3
by: Joey Powell | last post by:
Is it possible to specify a format string for one or more auto-generated datagrid columns? If so, could someone post an example? More specifically, I am interested in taking output like 27.0800000...
2
by: jburkle | last post by:
The following is the onclick method called when the "Renew" button is clicked by the user in my Windows application: ..... Private Sub cmdRenew_Click(ByVal eventSender As System.Object, ByVal...
11
by: Chris Ianson | last post by:
Hi all, Well having found this group to be a fountain of knowledge I have another question. And hey, no worries if you don't know or don't want to answer, please ignore this. Is there a way...
1
by: JamesB | last post by:
Hi. I'm developing a web service on my machine, but I want to be able to "publish" it to our webserver located off out in the internet cloud somewhere. I've installed the FP Extentions on the...
3
by: =?Utf-8?B?Q0QuU21hbGxleQ==?= | last post by:
Is there a command line switch available for the EventViewer which will allow me to specify which directory to view the available logs from? I will have multiple workstations writing to a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.