|
-
May 6th, 2002, 12:41 AM
#1
Thread Starter
Member
Anyone khow which method to open database is fastest ?
Dear All
I'am using VB6 and SQL 2000.
Anyone know which method of open database and recorset is fastest ??
Best Regards
Long
-
May 6th, 2002, 12:49 AM
#2
What are these "methods" you refer to?
Uhm.. use ADO, if that answers your question.
-
May 6th, 2002, 04:47 AM
#3
Thread Starter
Member
I use ADO, i mean is open connection and recorset.
Sample open connection to SQL :
1. Conn.Open "Driver={sql server};server=SvrName;database=DBName;uid=sa;pwd="
2. Use ODBC.
My Question is
Which method is fastest or anyone can give me some choice ?
-
May 6th, 2002, 04:50 AM
#4
DSN-Less is the fastest, and should be preferred. It doesn't have that extra layer like in ODBC and isn't slow like DSN.
connection strings
-
May 6th, 2002, 10:14 AM
#5
Black Cat
OLEDB is supposed to be faster than ODBC:
Code:
"Provider=SQLOLEDB;Server=ServerName;Database=DBName;Trusted_Connection=Yes;"
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
May 6th, 2002, 09:21 PM
#6
Thread Starter
Member
Thanks for helping me.
Best Regards
Long
-
May 6th, 2002, 09:29 PM
#7
-
May 6th, 2002, 09:56 PM
#8
Thread Starter
Member
Dear
I've a question
a. dim Conn as New ADODB.Connection
b. dim Conn as ADODB.Connection
set Conn = NEW ADODB.Connection
Which different of point a with b ?
Best Ragards
Long
-
May 6th, 2002, 10:23 PM
#9
PowerPoster
Speed wise there is no difference since the object is not really created untill the object is refrenced or a set statemnet is used.
When you use "Dim Myobj as NEW Class" the object is not created it is only refrenced. This is called "Early Binding". It helps when you are compiling the project because if there is an error with the Class it will show up then, but not is you use Late binding.
Late Binding would be
Dim MyObject as Class
Set MyObject = NEW Class
They are both created at the same speed. But i think late binding uses less resources.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
May 7th, 2002, 04:32 AM
#10
Thread Starter
Member
I want to make a small program client-server, where client ( at place A ) can access data at server ( at place B ).
I use ADO and Lease Line Connection, this is my sample code :
Dim Conn as New ADODB.Connection
dim Rec as New ADODB.Recordset
'Open Connection
Conn.Open "Driver={SQL Server};" & _
"Server=xxx.xxx.xxx.xxx;" & _
"Address=xxx.xxx.xxx.xxx,1433;" & _
"Network=DBMSSOCN;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword;"
'Open Recordset
Rec.Open "Select * from MyTable",Conn,AdOpenKeySet,AdLockoptismistic,AdCmdText
If Rec.recordcount > 0 then
'Do something
endif
When i try to debug my program, at position of open recordset is need a long time to open a table.
Anyone can tell me or can give a comment about my coding ?
Long
-
May 7th, 2002, 04:40 AM
#11
I think it's normal for it to take a long time, IF the computer B is a remote terminal. If it's on the same network, you can use it's UNC name... like \\computername.
-
May 7th, 2002, 10:17 AM
#12
Black Cat
Originally posted by Arc
Speed wise there is no difference since the object is not really created untill the object is refrenced or a set statemnet is used.
When you use "Dim Myobj as NEW Class" the object is not created it is only refrenced. This is called "Early Binding". It helps when you are compiling the project because if there is an error with the Class it will show up then, but not is you use Late binding.
Late Binding would be
Dim MyObject as Class
Set MyObject = NEW Class
They are both created at the same speed. But i think late binding uses less resources.
No - both those are early binding, which is faster because it compiles the COM stuff into your app.
Late binding is
VB Code:
Dim obj as [b]Object[b] 'the "Object" keyword, not any object
Set obj = CreateObject("ADODB.Command")
Thus, in late-binding, nothing is known about the object until run-time. If the VB6 IDE gives you Intellisense for an object, chances are it will be early bound.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
May 7th, 2002, 11:20 AM
#13
Bouncy Member
also:
Dim MyObject as Class
Set MyObject = NEW Class
is faster too
-
May 7th, 2002, 08:40 PM
#14
Thread Starter
Member
Dear Mendhak
Can you give me a detail how to use a UNC Name ?
Best Regards
Long
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
|