Dear All
I'am using VB6 and SQL 2000.
Anyone know which method of open database and recorset is fastest ??
Best Regards
Long
Printable View
Dear All
I'am using VB6 and SQL 2000.
Anyone know which method of open database and recorset is fastest ??
Best Regards
Long
What are these "methods" you refer to?
Uhm.. use ADO, if that answers your question.
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 ?
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
OLEDB is supposed to be faster than ODBC:
Code:"Provider=SQLOLEDB;Server=ServerName;Database=DBName;Trusted_Connection=Yes;"
Thanks for helping me.
Best Regards
Long
Disreguard :D
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
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.
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
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.
No - both those are early binding, which is faster because it compiles the COM stuff into your app.Quote:
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.
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.
also:
Dim MyObject as Class
Set MyObject = NEW Class
is faster too
Dear Mendhak
Can you give me a detail how to use a UNC Name ?
Best Regards
Long