|
-
Mar 30th, 2004, 12:38 AM
#22
Originally posted by ahara
Hello;
Your previous example of code should also work in Oracle, however I think another key point should be made. Another significant difference between Access and Oracle is performance. This is why Oracle is used for the really big and important stuff. Oracle has caching capabilities that Access does not. When you send a query to Oracle, it first checks the cache to see if it is already there. If not, it recompiles it and runs it - but if it finds it in the cache, the query will fetch the records more efficiently. We are an Oracle 8i shop over here. We have implemented a standard of using paramterized command objects only for all sql statements. The following example illustrates:
VB Code:
dim cmdCommand as new ADODB.Command
set cmdCommand.ActiveConnection = [your connection object]
cmdCommand.CommandType = adCmdText
dim prmParameter as new ADODB.Parameter
dim sql as String
sql = "update tableA set field1=?, field2=?, field 3=? WHERE rec_id=?"
set prmParameter = cmdCommand.CreateParameter("field1", [data type], adParamInput, [size of field], [value])
cmdCommand.Parameters.Append prmParameter
... 'add other two parameters
cmdCommand.CommandText = sql
cmdCommand.Execute
Now if this is totally new to you, check out MSDN's tutorial at
http://msdn.microsoft.com/library/de...jparameter.asp
With regards to the code above.....Notice how the sql statement uses "?" marks. These represent the paramters going in. The parameters must be specified in the same order as the "?" marks in the sql statement. So each time this statement comes into Oracle's sql compiler, it will be found in the cache and run right away. I hope this does not complicate matters too much for you, but Oracle is such a good database (WAY BETTER THAN ACCESS), I truly believe as developers we should make the most of it. Cheers!
I agree. Binding is the way to go for Oracle.
Cheers,
Abhijit
Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
save a blobFileStreamDataTable To Text Filemy blog
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|