22. april 2003 - 19:22
Der er
22 kommentarer og 1 løsning
problemer med sql
har en string som hedder: string = "Select * from tabel" den kører jeg med en docmd.runSql(string) Acces kommer med en fejl, som siger at der skal indsættes en sql sætning. hvad er problemet ???
Annonceindlæg tema
Cloud & AI
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
22. april 2003 - 19:24
#1
SQL = Et eller andet DoCmd.RunSQL
22. april 2003 - 19:25
#2
Prøv med: docmd.execute(string)
22. april 2003 - 19:30
#3
Prøv Docmd.runSQL string
22. april 2003 - 19:32
#4
Navnet på SQL skal naturligvis med SQL = Et eller andet DoCmd.RunSQL SQL
22. april 2003 - 19:32
#5
superjab > Skal du ikke ud at gå med hunden? :o)
22. april 2003 - 19:33
#6
You can NOT use the Docmd.runsql to RETURN records, you have to use a recordset for this!
22. april 2003 - 19:41
#7
Personligt plejer jeg at bruge: strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database.mdb") Set myConn = Server.CreateObject("ADODB.Connection") myConn.Open strDSN strSQL = "SELECT * FROM tabel" set RS = myConn.execute(strSQL) når jeg skriver ud
22. april 2003 - 19:47
#8
'You must have a reference to DAO Dim dB As DAO.Database Dim rs As DAO.Recordset Dim sSQL As String Set dB = CurrentDb Set rs = dB.OpenRecordset("SELECT * from tablel") With rs Do Until .EOF Debug.Print rs!ID 'Regner med at der er en felt = ID .MoveNext Loop End With End Sub
22. april 2003 - 19:48
#9
Til
22. april 2003 - 19:49
#10
using ADO Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset With rs Set .ActiveConnection = CurrentProject.Connection .Open "Select * From tabel", , , adLockOptimistic Do Until .EOF rs("someshit") = "TESTING" .MoveNext Loop End With rs.Close
22. april 2003 - 19:49
#11
Til?
22. april 2003 - 19:50
#12
you dont need this :o) rs("someshit") = "TESTING"
22. april 2003 - 19:51
#13
funkytoget kan den engelsk?
22. april 2003 - 19:51
#14
du kan ikke brug docmd.runsql for at SELECT records!
22. april 2003 - 20:19
#15
Yes, funkytoget do speak english
22. april 2003 - 20:30
#16
I have problems with ADO, i have never used it before, Can any of you create a simple example using ADO, and maybe explain some of the lines :-)
22. april 2003 - 20:38
#17
'using ADO Dim cn As ADODB.Connection 'connection to database Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset 'create a NEW recordset With rs 'I'm now going to work with rs (recordset) 'Point the recordsets connection to point at THIS db's connection Set .ActiveConnection = CurrentProject.Connection 'Now I open the recordset for read/write selecting data from tabel .Open "Select * From tabel", , , adLockOptimistic 'Now I loop through all records until EOF (end of file) Do Until .EOF 'If there is a field named someshit then I change the value rs("someshit") = "TESTING" .Update 'and update it in the dB .MoveNext 'then move to next record (or EOF!) Loop End With rs.Close 'close recordset
22. april 2003 - 20:40
#18
23. april 2003 - 13:11
#19
and ?
29. april 2003 - 19:16
#20
now there's gone 7 days, if you dont answer soon then admin will be on your tail!
now I'm p...ed off >anmeldt!
Terry>> He has given you the points. Are you still upset? Best regards FCS/Coadmin
fcs>I wasnt upset I was p...ed off :o) All's well now though, tak :o)
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser