473,395 Members | 1,937 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,395 software developers and data experts.

Refreshing a Datagrid

lee123
556 512MB
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 "BillDetails" the connectionstring is connected to "BillDetails" 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 "BillInformation" the connectionstring is connected to "BillInformation" 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 "BOUNDCOLUMN" 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 #1
17 2515
QVeen72
1,445 Expert 1GB
Hi,

You have one extra single quote in your query..

In the Table if BillID is Numeric, then give your Query statement like this :

strQuery = "Select * FROM DetailsT WHERE BillID = " & _
Val(DataList1.BoundText)

If it is Text then :

strQuery = "Select * FROM DetailsT WHERE BillID = '" & _
DataList1.BoundText & "'"


Regards
Veena
Apr 30 '09 #2
lee123
556 512MB
Well I have Tried Both Ways And It Still Points To The "REFRESH" the error it gives me is (Syntax error in FROM clause)

lee123
Apr 30 '09 #3
lee123
556 512MB
thanks for the response it took me awhile to figure it out but i got it working i have another question for you after i have click on a name in my list and the datagrid changes to that bill there are currency values in the the details database how do i show them in currency in the datagrid after i have click on a name. because right now when the form opens every bill is showing and i have set the currency value through the properties in the datagrid and it is currency.

but when i click on a name it goes back to normal. how do i change that

lee123
Apr 30 '09 #4
lee123
556 512MB
i have got this working but i can't print out the datagrid in a txtfile so i would like to know how i can use the datacombo and textboxes for this instead, I mean is the code any different than the datagrid because i have 8 textboxes i would like to bind to it. so when i drop down the datacombo box it pulls the information that goes with the name..and fills the textboxes with the details

lee123
May 5 '09 #5
lee123
556 512MB
please respond to this question.............

lee123
May 6 '09 #6
QVeen72
1,445 Expert 1GB
Hi,

Add Place the Textboxes on the Form, and Bind them to the ADODC,
by setting "DataSource" and "DataMember" properties of the textbox..

Regards
Veena
May 7 '09 #7
lee123
556 512MB
ok i have the textbox already on ther form i have got the one adodc control bound to the datacombo (Information),

then i have Eight textboxes on the form as well for the (details) with another adodc control if i understand what your saying is i don't need the other adodc control?

Do I use both Adodc Controls for this? or just the one for the datacombo for all?

lee123
May 7 '09 #8
QVeen72
1,445 Expert 1GB
Hi,

I Guess, you are doing a Master-Detail format, then you will need 2 ADODC's.
You can Bind a Textbox (Or any) Control to Only one ADODC.
Check which adodc has the fields you are wanting to display, and bind that.

Regards
Veena
May 8 '09 #9
lee123
556 512MB
well the thing is that i have these textboxes on the form but i want the company name from another table so when i choose a name the information will fill in the textboxes is this possible through code, through the one adodc control to get the name from the other table?

lee123
May 8 '09 #10
QVeen72
1,445 Expert 1GB
Hi,

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

Regards
Veena
May 9 '09 #11
lee123
556 512MB
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 Expert 1GB
Hi,

For each TextBox, write this code in FormLoad event:

Set Text1.DataSource = ADODC1
Text1.DataField = "Field1"

Change control/Field names accordingly..

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

Set Text1.DataSource = 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 Expert 1GB
Hi,

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

Regards
Veena
May 12 '09 #15
lee123
556 512MB
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 Expert 1GB
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 512MB
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
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...
0
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...
5
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...
1
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...
7
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...
4
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...
1
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...
1
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...
0
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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...
0
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,...

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.