Technical Help & Discussion > Website Design & Programming

filtering records vb

<< < (2/2)

sam:
umm

hopefully u will

with FORTRAN hat on...yes i know old but its fast and thats what I use for my research. In FORTRAN you can read in say the first word of an arugment and then just do a do loop until you get the right input? is this not possible in vb?

sam

davypipes:
EUREKA!! :idea:  I GOT IT ..ok rather i found a way around it!!!
ok so this is what i decided to do ...
i declared a new recordset and made a string variable where i can put sql code as follows:

Dim pstrSQL As String
Dim rs As New ADODB.Recordset


pstrSQL = "SELECT name FROM sale where firstname  like'" & "da" & "___'"
'the ___ portion represents the rest of the characters ie: the above code will bring anything starting with "da" +______ any other characters"

'then in this line of code i get the recordset based on the sql statement
rs.Open pstrSQL, cn, adOpenStatic, adLockOptimistic

'then display the records on a datagrid

Set DataGrid1.DataSource = rs


now all thats remaining is to take that filtered data and copy it to a different table! :cry:  now how do i do that!!??? arghhhh anyone good at sql? sam? :(

sam:
your select statement will surely have set the data to that array, you did read out your results to an array didnt you? if so surely then it is just a process of reading out this array (or datagrid whatever it is) to a file - say a tabulated text file, does this make sense?

davypipes:
emmm...array? well  i didnt use any array ! i kinda thought :blush:  that theres a way i can do it in sql...with just a simple statement! :?

sam:
the output of your sql query is just your result. this result is surely your table?

Navigation

[0] Message Index

[*] Previous page

Go to full version