con.New1
con.Open("DSN=Sales;")
[COLOR="seagreen"]'con.Open("Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\pacientes.mdb;" )
'This would be for an ODBC DSN-Less connection[/COLOR]
cmd.New1("",con.Value)
reader.New1
con.BeginTransaction(cmd.Value)
[COLOR="seagreen"]'Must specify the Command object used[/COLOR]
cmd.AddParameter("id1",cmd.typeDouble )
[COLOR="seagreen"] 'Must specify the paramater data type[/COLOR]
cmd.SetParameter("id1","9500")
cmd.AddParameter("id2",cmd.typeDouble )
[COLOR="seagreen"]'Must specify the paramater data type[/COLOR]
cmd.SetParameter("id2","9520")
cmd.CommandText="SELECT * FROM final WHERE id> ? AND id< ?"
[COLOR="SeaGreen"] 'Parameter's names don't work in ODBC with CommandText,
'so you have to write question marks that will be replaced in the order that you added the parameters.[/COLOR]
reader.Value=cmd.ExecuteReader
Do While reader.ReadNextRow
Msgbox(reader.GetValue(1))
Loop
reader.Close
con.EndTransaction