Avatar billede doctorpurple Nybegynder
16. april 2002 - 08:47 Der er 9 kommentarer og
1 løsning

adodc

jeg kunne godt tænke mig at få lidt hjælp til adodc controlden hvordan skifter jeg recordsource ( SQL command text ) i RUN time... på forhånd tak jeg sætter pointene lidt høj i håb om at få lidt hjælp hvis jeg indlægger en kommentar til et andet problem
Avatar billede terry Ekspert
16. april 2002 - 09:19 #1
what is it you want to do exactly? Can you give an example?
Avatar billede doctorpurple Nybegynder
16. april 2002 - 09:24 #2
with adodc1
.recordset.close
.recordsource "select * from xxx where xxx = xxx
.recordset.open
end with
somthing like that.... I just dont know how to do it right
Avatar billede terry Ekspert
16. april 2002 - 10:10 #4
Here is a very simple example:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Dim sSQL As String

   
    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " & App.Path & "\ado.mdb"
   
    With rs
        sSQL = "SELECT * FROM tbl1 WHERE fld1 = " & InputBox("Enter something ", "", "")
       
        .Open sSQL, cn
   
   
        Do Until .EOF
            Debug.Print "Field 1 =" & rs("fld1") & " SomeShit =" & rs("someshit")
            .MoveNext
           
        Loop
       
    End With
    rs.Close
    cn.Close
   
I can send you the database (Acces) and VB code if you like?
Avatar billede doctorpurple Nybegynder
16. april 2002 - 10:19 #5
i dont know how it works with adodc control I pretty much a newbie too this thing
Avatar billede terry Ekspert
16. april 2002 - 11:04 #6
You should be able to set the recordsource, if this is what you mean!

datPrimaryRS.RecordSource = "select fld1,fld2 from tbl1 WHERE fld1 = 1"
datPrimaryRS.Refresh
Avatar billede doctorpurple Nybegynder
16. april 2002 - 11:08 #7
what is datprimaryrs i only have a adodc control and a datagrid on my form
Avatar billede terry Ekspert
16. april 2002 - 11:12 #8
can you send me the application? If so, zipped to dktebrsa@europe.lego.com
Avatar billede doctorpurple Nybegynder
16. april 2002 - 11:16 #9
I have completet now adodc1.recordsource = Text1.text
adodc1.refresh

thanks a lot can i ask you questions if i need some help another til...
Im happy it works and it it easy ..
Avatar billede terry Ekspert
16. april 2002 - 11:22 #10
I dont mind if its a short question, but you should go through eksperten, thats where the points are :o)
Also you may get a number of different answers which can also help learning!

Thanks :o)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester