Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBGRID control

Status
Not open for further replies.

kiramoto

Programmer
May 13, 2002
9
BR
Hi everyone ( again )...
I have a DBGrid Control and I wanna display some data from SQL Server. I established a connection to SQL :

vStrConnection = "xxx"
Set Conn = CreateObject("ADODB.Connection")
Conn.Open vStrConnection

sql = "select * from myTable"
Set rsAux = Conn.Execute(sql)
If Not rsAux.EOF Then
While Not rsAux.EOF
DBGrid1.text= rsAux.Fields("field")
rsAux.MoveNext
Wend
End If

It didn't work, and I couldn't get through this... Can anyone help me??

thanks in advance,



 
Why are you using the Text property of the DBGrid? You're not using that to populate the grid, are you? If so, you're way off track. You want the DataSource property.
If that's not the problem, you'll have to tell us exactly what error you're getting and on what line.
 
thanks 4 responding my doubt...
Yes, I want to populate the grid with the SQL data.
I changed the code :

vStrConnection = "xxx"
Set Conn = CreateObject("ADODB.Connection")
Conn.Open vStrConnection

sql = "select * from myTable "
Set rsAux = Conn.Execute(sql)

If Not rsAux.EOF Then
DBGrid1.DataSource = rsAux
End If

And it doesn't work anyway. the error :

"run-time error '430':
class does not support Automation or does not support expected interface"

What should I do??
Thanks,

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top