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

datagrid and a datalist

lee123
556 512MB
i have a book i have bought from amazon.com called "visual basic 6.0 advanced topics" and in one of the examples it has something i have been trying to figure out for awhile it has a datalist and a datagrid the datalist i have filled with the database northwind database (customers tbl) and the datagrid i wanted to fill with the (orders tbl) i have set all the properties to what this book says but when i run the code it gives. it keeps giving me an error: to see if i got this code the way i should have it please look at this and tell me what im doing wrong.

the erorr it gives me is:(syntax error FROM clause) from the adodc2
adodc2 on mine is for the datagrid
adodc1 is for the datalist

i tried this (my Code)
Expand|Select|Wrap|Line Numbers
  1. Private Sub DataList1_Click()    
  2.     Dim cstrsql As String
  3.     cstrsql = "select * from customers " & " where orderID = " & " '  " & DataList1.BoundText & " ' " 
  4.    Adodc2.RecordSource = cstrsql
  5.     Adodc2.Refresh
  6. End Sub
  7.  
in this book there code is
Expand|Select|Wrap|Line Numbers
  1. private sub dblname_click()
  2.  
  3.   dim pstrsql as string
  4.  pstrsql = "select * from tblpayrolldetail " & " where fldemployeeid = " & " ' " & _
  5.     dblname.boundtext & " ' "
  6. adpayrolldetail.recordsource = pstrsql
  7. adpayrolldetail.refresh
  8.  
  9. end sub
  10.  
there are two adodc controls in theres called

payroll master ( for the datalist)
payroll detail ( for the datagrid)

I need to understand how i can apply this example in the book to a project im doing for me....

lee123
Jan 10 '08 #1
8 4242
Ali Rizwan
925 512MB
Are you using this code for filling datagrid or data list or list view controls?
If yes will i tell you another command to fill them which is easier an quick.
if no then also tell me what are you trying to do?
Actually i am not much expert in sql but know a bit.

Regards
>> ALI <<
Jan 11 '08 #2
lee123
556 512MB
i am trying to fill the datagrid from the information i select from the datagrid for instance if i select a person from the datalist his information would fill in the datagrid and no one else's


lee123
Jan 11 '08 #3
QVeen72
1,445 Expert 1GB
Hi,

What are "BoundColumn" and "DataField" for the datalist.
Is Data List populated properly..?

I guess, you are Filling details of Customer name and ID in DataList,
but in Query (datalist_Click) you have queried for OrderID.... Does not match here..

Regards
Veena
Jan 11 '08 #4
lee123
556 512MB
this is where i get confused in this book it gives the second example (not the first) there bound column they call (bound text) if that's the same as bound column. they put the employeeID and then used it in a select statement to select the matching payroll details.(this is for there datalist which is named - dblName)

i tried to use the northwind database for my example in mine the datalist bound column is set to the orderID maybe that's wrong (huh) and the datafield is set to customername. so when i click it the information about that customer would show up in the datagrid. but as you can see it didn't work. if you look at the northwind database and tell me why or if i did something i wasn't suppose to or even a better way that would do just fine. im trying to understand this SQL but it's trickier than the vb language it self.

oh just to note in the northwind database in the customer table it has an customerID. but when you go to the order table it only has a orderID and when you go to the order detail table it has only the order detail id. i guess i was looking for the customerID in the Order table but it's not there.

lee123
Jan 11 '08 #5
QVeen72
1,445 Expert 1GB
Hi,

What you can do is :
Fill DataList with CustomerName(ListField) and CustomerID (BoundColumn)
and In Click event, Query Orders for the Selected Customer:

"Select * From Orders Where CustomerID = '" & Datelist1.BoundText & "'"
Populate ADO/Datagrid with the above query

Regards
Veena
Jan 11 '08 #6
lee123
556 512MB
tell me something QVeen72,

in the ado's i have on the form

adodc1, i have set the connectionstring with the northwind database. right?
and the recordsource to the customers table. right?

then for:

adodc2, i have set the connectionstring with the northwind database. right?
and the recordsource to the orders table right?

the datalist i have set it's boundcolumn to customerID & the listfield to customersname

ok the datagrid i have set the datasource to adodc2 right?

and i did what you said and nothing? it keeps giving me an erorr:(syntax erorr in from clause)

lee123
Jan 11 '08 #7
lee123
556 512MB
i have figured it out

but one question can i use a dropdown box for this as well to populate the datagrid and the rest of the textboxes instead of a datalist and use the code i have now

lee123
Jan 12 '08 #8
QVeen72
1,445 Expert 1GB
Hi,

Instead of DataList, use a DataCombo...
Both work with same functionalty with slight difference..

Regards
Veena
Jan 12 '08 #9

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

Similar topics

1
by: DotNetJunkies User | last post by:
Hi, I was wondering if it is possible to load datagrid into datalist programatically using ITemplate interface with the following structure and place intp placeholder control. PlaceHolder -...
3
by: CVerma | last post by:
Hi, I have an embedded datagrid within a datalist. I am not able to perfrom paging in the datagrid. Any ideas? Here is my code: Here is my Simplegrid.cs file: using System; using...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
2
by: Alex Smith | last post by:
Hi friends Can anybody tell me where to use datagrid and where to use datalist. Or explain Different between DataGrid and DataList. Regards, Alex
0
by: Chris | last post by:
I've been searching all over and think I am close, but keep getting the error "Index out of range" when trying to reference a nested datagrid when an OnEditCommand event is raised. When the...
1
by: needin4mation | last post by:
Hi, I have a datalist. In this datalist I have a datagrid. The datalist is the master. The datagrid is the detail. It works fine. I populate the datagrid inside of the datalist using the...
1
by: weird0 | last post by:
What is the difference between a DataList control and DataGrid control ? How and where are DataLists used? Can somebody place some good links for its use.
1
by: Brock | last post by:
First note that I am using Framework 1.1. I have an .aspx page that is displaying a list of employees, but only the Employee Number, First Name, Last Name, and Title. It is working great. I...
1
by: Brock | last post by:
Thanks in advance... (you can see a screenshot of what my form looks like currently at http://www.juggernautical.com/DataGrid.jpg - the Datalist is super-imposed in 'design view' but the DataGrid...
17
lee123
by: lee123 | last post by:
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...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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.