Adodc and datagrid

dpapala
04-20-2004, 12:59 PM
hi,
i have a table in ms access named "students" and i want to fill a datagrid with an sql query that retrieves data from this table.
-----------------------------------
Adodc1.RecordSource = "Select studid,schools,depart From students where studid =" & Text6.Text
Set DataGrid1.DataSource = Adodc1
-----------------------------------
I use this code but on the datagrid i see the 3 fields for all the records not only the records that the id of the student is equal to text6.

Any suggestions?

DaddyHarris
04-20-2004, 01:25 PM
Is text6.text a number or string? If it is a string then you need...

...Where studid = '(singletick)" & Text6.text & "'(singletick)"

dpapala
04-21-2004, 01:41 AM
Is text6.text a number or string? If it is a string then you need...

...Where studid = '(singletick)" & Text6.text & "'(singletick)"

I tried this too ("Select studid,schools,depart From students
where studid =' " & Text6.Text &" '

but i have the same results.
Is there another way to fill the datagrid?

RedLeader
04-21-2004, 06:55 AM
I tried this too ("Select studid,schools,depart From students
where studid =' " & Text6.Text &" '

but i have the same results.
Is there another way to fill the datagrid?

You have to use .Refresh
Adodc1.RecordSource = "Select studid,schools,depart From students where studid =" & Text6.Text
Adodc1.refresh
Set DataGrid1.DataSource = Adodc1

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum