473,778 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refreshing a Datagrid

lee123
556 Contributor
I know this is a free site and the moderators or anybody don't have to answer if they don't want to.. but if there is someone who knows how to answer this question please help with this one.

i have changed my project so many times to try to get the results i want but can't seem to get this one thing to work the datagrid and datalist to work right. i have looked on the web to see if i could do it another way. and read so many books but there isn't another way i have found i have searched this site but nothing but the posts i have left and certainly i won't find the answers there. Because it only has the same question posted. so i guess i will go through my question again.

I have made a program so when i pay a bill i can click on the name of the bill in the datalist. and only them bills for that name will show in the datagrid.

the way i have this set up is, i have TWO ADODC controls on the form. and one datagrid and one datalist.

the first ADODC control is for the DATALIST and the second ADODC control is for the DATAGRID.

the datagrid ADODC2 is connected to a database i have made with the "Visual Data Manager" called "BillDetail s" the connectionstrin g is connected to "BillDetail s" and the recordsource is to the table "DetailsT" which in the database i have these fields

BillID
AmountDue
AmountPaid
DueDate
DatePaid
ReferenceNumber
BillBalance
The "BillID" I have made a text field because i want to add my own ID's. I don't know if you can do this but i have.

the datalist ADODC1 is connected to a database i have made with the "Visual Data Manager" called "BillInformatio n" the connectionstrin g is connected to "BillInformatio n" and the recordsource is "SELECT * FROM DetailsT" the "ROWSOURCE" is to the ADODC1. the "LISTFIELD" is set to the "BILLNAME" the "DATASOURCE " is to ADODC1 the "DATAFIELD" is to "BILLNAME" the "BOUNDCOLUM N" is to the "BILLID" which in the database i have these fields

BillID
BillName
Address
City
State
ZipCode
PhoneNumber
The code for the DATALIST click event is this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Datalist1_Click()
  2. Dim strQuery As String
  3. strQuery = "Select * FROM DetailsT WHERE BillID = " & _
  4. DataList1.BoundText & "'"
  5. With Adodc2
  6. .RecordSource = strQuery
  7. .Refresh   '<-----------'This is where i am getting the error
  8.                           'it's not refreshing the datagrid
  9. End With
  10. With DataGrid1
  11. .ClearFields
  12. .ReBind
  13. End With
  14. End Sub
So there it is i hope i can get a response for this

lee123
Apr 29 '09
17 2555
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

Yes, If the data is from another Table, then you will need another ADODC

Regards
Veena
May 9 '09 #11
lee123
556 Contributor
all of that being said how do i modify this code to do this with 8 textboxes instead of a datagrid:



Expand|Select|Wrap|Line Numbers
  1. Dim strQuery As String
  2. strQuery = "Select * FROM DetailsT WHERE BillID = """ & DataList1.BoundText & """"
  3. With Adodc2
  4.     .RecordSource = strQuery
  5.     .Refresh
  6. End With
  7. With DataGrid1
  8.     .ClearFields
  9.     .ReBind
  10. End With

lee123
May 10 '09 #12
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

For each TextBox, write this code in FormLoad event:

Set Text1.DataSourc e = ADODC1
Text1.DataField = "Field1"

Change control/Field names accordingly..

Regards
Veena
May 11 '09 #13
lee123
556 Contributor
For each TextBox, write this code in FormLoad event:

Set Text1.DataSourc e = ADODC1
Text1.DataField = "Field1"

Change control/Field names accordingly..
OK i have done what you have said and the only one that works is the "ID" field the rest keeps giving me an error please view the code and see if i have done this right:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.     Set BillID.DataSource = Adodc1
  3.     Set AmountDue.DataSource = Adodc1
  4.     Set AmountPaid.DataSource = Adodc1
  5.     Set DueDate.DataSource = Adodc1
  6.     Set DatePaid.DataSource = Adodc1
  7.     Set PaymentType.DataSource = Adodc1
  8.     Set ReferenceNumber.DataSource = Adodc1
  9.     Set BillBalance.DataSource = Adodc1
  10.     BillID.DataField = "BillID"
  11.     AmountDue.DataField = "AmountDue"
  12.     AmountPaid.DataField = "AmountPaid"
  13.     DueDate.DataField = "DueDate"
  14.     DatePaid.DataField = "DatePaid"
  15.     PaymentType.DataField = "PaymentType"
  16.     ReferenceNumber.DataField = "ReferenceNumber"
  17.     BillBalance.DataField = "BillBalance"
  18. End Sub
just one more question. in the properties box of each textbox do i keep them bound to the other adodc or not and there field names.

lee123
May 11 '09 #14
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

What is the Recordsource of ADODC1..?
All the FieldNames should be present in that recordsource..

Regards
Veena
May 12 '09 #15
lee123
556 Contributor
it is to a table called "BillInfo". ... Oh Maybe the "BillID" works because That Is The One Field That Is The Same In That Table. you see that's why i asked you how can i, or is it possible to do this in code with two tables in my first post i list all the fields on both tables

ADODC1

Expand|Select|Wrap|Line Numbers
  1. BillID
  2. BillName
  3. Address
  4. City
  5. State
  6. ZipCode
  7. PhoneNumber 
ADODC2

Expand|Select|Wrap|Line Numbers
  1. BillID
  2. AmountDue
  3. AmountPaid
  4. DueDate
  5. DatePaid
  6. ReferenceNumber
  7. BillBalance
you know i thought that the datacombo was like the datalist you could use this same code:

Expand|Select|Wrap|Line Numbers
  1. Dim strQuery As String 
  2. strQuery = "Select * FROM DetailsT WHERE BillID = """ & DataList1.BoundText & """" 
  3. With Adodc2 
  4.     .RecordSource = strQuery 
  5.     .Refresh 
  6. End With 
  7. With DataGrid1 
  8.     .ClearFields 
  9.     .ReBind 
  10. End With 
i guess you can't modify this code for the datacombo to work

lee123
May 12 '09 #16
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

In that Case, Set TextBox's DataSource To ADODC2.
Since BillID is common in both the tables, it is being shown..
For others, just change the datasource..

Regards
Veena
May 14 '09 #17
lee123
556 Contributor
well i tried what you have said to do but it still don't work, i have changed all to adodc2 in code and got an error then i tried to change it in the properties box but that didn't work either. these are separate tables i am using i know the id's are the same but they have different fields that's why it probably don't work. but thanks anyway for your responses i appriciate it very much..

lee123
May 15 '09 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1353
by: serge calderara | last post by:
Dear all, I am develpping a .NET vb application fro 2000 and XP. I have actually an Collection list of Type, where type have 4 variables inside This collection list can be really long. I then pass the content of that collection list of type to a dat grid object which display them properly. The content of my collection list might change, it could be more records or
0
1754
by: msnews | last post by:
Hi -- I'm very, very new to ASP.Net, and I've been trying for several days to figure out how to update a datagrid AND refresh it on the client side so that the page doesn't refresh. I've torn my code apart over and over each time I tried what I thought would be the code that would solve my problem. Maybe I'm going down the completely wrong path here. Essentially, here is an explanation of my ASP.NET webform application and what I want...
5
2598
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order date, name, address etc) about the selected row in the datagrid... My problem is when I enter a new record in the details tabpage (saves data to database), and go back to the datagrid. Only the data from the PM-table
1
1585
by: Hans | last post by:
I have a Windows.Forms.Form containing a DataGrid where the DataSource is a DataView. Everything refreshes fine after adding, deleting or editing rows. When I close the dialog and reopen it with a new set of data, all is okay showing the new rows of data. But when I go back to the first set of data, I get the correct data except for ONLY the second column of the first row contains the data from the second set of data. If I cause it to...
7
3556
by: A.M | last post by:
Hi, I want to refresh my DataGrid data on every postback. I have following code in Page_Load event, but after first page load, the DataGrid never gets refresh. Here is the code i have in Page_load (it works at first page_load): Dim DS As DataSet Dim MyConnection As System.Data.SqlClient.SqlConnection
4
2131
by: Rod | last post by:
I posted a message to this group yesterday asking how to pass parameters to a web form that is the source of an IFrame on a parent web form. I've gotten my answer, and it works. Thanks! Now I have a different problem. The web form that is in the IFrame has a DataGrid in it. I have a button column in it which I use to trigger the deletion of the row in the database, and I want it to also reflect that deletion in the data grid. The...
1
2026
by: Jennyfer J Barco | last post by:
Hello I have a datagrid and a linkbuttom in the datagrid that says Picture, every time I click on the link "Picture" my program opens a popup window showing a picture of the item the selected and information about the item. On the html of the datagrid I have the following: OnItemCommand="Grid_CartCommand" OnItemCreated="DataGrid_ItemCreated". My VB functions are the following: Sub DataGrid_ItemCreated(ByVal Sender As Object, ByVal e As...
1
1818
by: pv_kannan | last post by:
One of our dev team members is having a strange problem with a datagrid... We are not seeing a datagrid's data getting refreshed after a new row is entered in a popup window inspite of resetting the datasource and rebinding it. We have a datagrid (enabled viewstate) that binds to a collection class that inherits the IList interface. The datagrid displays list of associated contacts for a customer order.
0
1277
by: rraw | last post by:
hello! i have a poblem refreshing the datagrid the datagrid gets updated but what should i do in order to make the grid invisible once i am thru the dataviewing from the datagrid.. plz help me out
0
9632
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9471
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8958
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4036
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 we have to send another system

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.