adodc refresh method failed
hello all,
i tried to assign the recordsource property of an adodc control on my form to a variable, however it says my sql syntax is not correct and refer to its manual.
and then the refresh method failed.
here is my code:
Private Sub Command4_Click()
Dim strQuery As String
strQuery = "Select * from (bedrijf) where bedrijfnaam = 'RBTT'"
AdoBedrijf.RecordSource = strQuery
AdoBedrijf.Refresh
DataList1.ReFill
DataList1.Refresh
End Sub
how ever i tried every possible sql query string. No luck. My database is an mysql database.
Where i'am going wrong?
Can someone please help me?
thanks,
Randjana
[760 byte] By [
randjana] at [2007-11-11 8:37:06]

# 6 Re: adodc refresh method failed
First when the button is clicked, this is the error message:
[MySQL][ODBC 3.51 Driver][mysqld-5.0.19-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Select * from bedrijf where bedrijfnaam = 'RBTT'' at line 1
and after this:
Run-time error '-2147217900 (80040e14)':
Method 'refresh' of object 'IAdodc' failed
And if I debug then AdoBedrijf.Refresh is yellow.
# 7 Re: adodc refresh method failed
helo all,
My problem is solved!!! thank you for all yor efforts.
Changed commandType value from 2-adcmd table to 8 - adCmdUnknown and it does exactly what i wanted. Once again thanks......
But there is now something else. with a button click i want to display company names in the datalist starting with a,b,c,d,e, eg.
something like
strQuery = "Select * from bedrijf where bedrijfnaam like 'a%', 'b%', 'c%', 'd%'"
Is it possible to do this with a query in vb?
Thanks,
# 8 Re: adodc refresh method failed
Believe it or not that was my next suggestion (although adCmdText is appropriate). ;-)
I'm not sure what the MySQL SQL syntax might be but you could try the following:
strQuery = "Select * from bedrijf where bedrijfnaam like '[abcd]%'"