private sub command_click()
if text.text<>"" then
dim cn as new adodb.connection
dim rs as new adodb.recordset
dim strsql as string
with cn
.provider="sqloledb"
.connection="data source=aa;initial catalog=b;user id=sa;password=sa"
.open
end with
strsql="select * from table where 車站名='"& trim(text.text) &"'"
rs.ActiveConnection = cn
rs.CursorLocation = adUseClient
rs.Open strsql, cn, adOpenDynamic, adLockOptimistic
set datagrid.datasource=rs
end if
end sub