|
Faster at doing anything and everything. It is tremendously faster at inserting and setting data then ADO. I have the insert test setup to insert 1000 (10 field) empty records then I set each 50 char field one by one and update after each record is written and my results were as follows: ADO: 5638ms and OLE: 2223ms but this is of course with my custom ole wrapper class. Unfortunately I cannot post any of the code because it is property of my company seing as how I wrote it for them, but I might be able to post the program and let people try it out. It is setup as follows: It has 3 panes one on top is a CEditView which you can type any valid SQL statement and execute it. The bottom is a CListView which displays the resulting recordset, and the pane on the right is a CListView which displays the benchmark results in ms. It allows opening any ADO database and any datasource with any provider that is installed on the system. I'll ask my boss if I can post the application if there are enough takers.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
If you are going to use Visual C++ then I can tell you two good reasons why not to use ADO.
1. Easy to develope code using the OLE DB Wizards, the Visual C++ environment does not have the wizards to write code with ADO
2. ADO sits on top of OLEDB. Therefore ADO is not optimised for your specific database, therefore ADO is not efficient.
Generally ADO is used for all non Visual C++ application like Java, VB, VBScript, Delphi. Microsoft don't publish many examples in ADO as they want you to use OLE DB Consumers.
|
|
|
|
|
Sorry to correct you, but in the new ADO 2.7 docs are a lot examples in VC++ using
the import statement
|
|
|
|
|
for my application i need to develop a component which allows the user to select the table,fields inside the table and based on his selection a sql query needs to be build. This is similar to the query builder in ms-access. Is there any component available for the above purpose or is it possible through some com interfaces.Any pointers, references i can get is most welcome.
thanks in advance.
Cheers
kannan
|
|
|
|
|
How do I?
I have a database with 2 tables [Buyers] and [Orders]. The [Buyers] table has a field [BuyerNumber] and the [Orders] table has a field [Purchaser]. These two fields are both the same information, i.e. [BuyerNumber] points to the customer and so does [Purchaser].
I want to select only those records where [BuyerNumber] and [Purchaser] are equal to the information I pass to the query (m_Buyer for example).
I can get records for All, ie. [Buyers] times [Orders] or I can get No records.
Here's the m_StrFilter I'm using:
"[BuyerNumber] = '200' OR [Purchaser] = '200'"
This, unfortunatley, returns records for everything.
All help appreciated, but I'm VERY new to this. You will be gentle, please.
Richard
|
|
|
|
|
try with something like:
SELECT * FROM Buyers, Orders WHERE (Buyers.BuyerNumber = Orders.Purchaser)
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Specification
In a typical database management system a concept of database schema provides
full information about a logical organization of database structures. The principal
requirement of logical database consistency states that in every moment of time
contents of a database must be consistent with the respective database schema. The
queries submitted to a database must be syntactically consistent with a database
schema as well. The idea of scheme evolution refers to the changes in a database
scheme over a certain period of time. It would be convenient to modify a database
schema depending on users' requirements. The conventional query languages, like
for instance SQL, does not allow for references to a number of different versions of
the same database schema. Unfortunately, the frequent modifications of database
schema require restructuring of database contents and modification of user
applications. As the result, frequent evolution of a database schema significantly
decreases performance of a database system and requires continuous upgrades of
user applications.
Objectives
The objective of this project is to propose architecture for database system where
frequent evolution of database scheme has no significant impact on performance of the
system and it is transparent to users' applications.
|
|
|
|
|
Hello,
I'm trying to write an OLE DB Wrapper class and have created a function called SetStringFieldValue and inside that function I need to set 1 columns data to the string passed to the function. I have yet to find any examples of SetData anywhere and for some reason its not working for me. Any help is greatly appreciated.
[PRE]
void COleDBWrapper::SetStringFieldValue(int nIndex, LPCTSTR lpszValue)
{
CString strValue(lpszValue);
IRowsetChange* pIRowsetChange = (IRowsetChange*)m_pUnkRowsetChange;
IRowsetUpdate* pIRowsetUpdate = (IRowsetUpdate*)m_pUnkRowsetUpdate;
IAccessor* pIAccessor = NULL;
HACCESSOR hAccessor;
ULONG cBindings = 1;
DBBINDING rgBinding[1];
memset(rgBinding, 0, sizeof(DBBINDING));
char szValue[50];
_tcscpy(szValue, strValue.GetBuffer(0));
rgBinding[0].iOrdinal = nIndex;
rgBinding[0].dwPart = DBPART_VALUE|DBPART_STATUS|DBPART_LENGTH;
rgBinding[0].obLength = (strValue.GetLength() + 1) * sizeof(TCHAR);
rgBinding[0].obStatus = (strValue.GetLength() + 1) * sizeof(TCHAR);
(CString)rgBinding[0].obValue = szValue; // -- DOESN'T DO JACK! -- //
rgBinding[0].wType = DBTYPE_STR;
rgBinding[0].pTypeInfo = NULL;
rgBinding[0].pObject = NULL;
rgBinding[0].pBindExt = NULL;
rgBinding[0].dwMemOwner = DBMEMOWNER_CLIENTOWNED;
rgBinding[0].cbMaxLen = (strValue.GetLength() + 1) * sizeof(TCHAR);
rgBinding[0].dwFlags = 0;
HRESULT hr = m_pUnkRowset->QueryInterface(IID_IAccessor, (void**)&pIAccessor);
if (FAILED(hr))
return;
hr = pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, 1, rgBinding, 0,
&hAccessor, NULL);
if (FAILED(hr))
return;
hr = pIRowsetChange->SetData(m_hRow, hAccessor, szValue);
// hr is ALWAYS DB_E_ERRORSOCCURRED
}
[/PRE]
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Hi,
I am using ADO tecnology to execute stored procedure.
Does anyone know how to read out a parameter from sp into VC++ variable
I need to get @file_id (which is set at the bottom of sp)
thank you,
bartek
My stored procedure:
CREATE PROCEDURE [sp_StandardFileNew]
@receive_date varchar(20),
@pj_id int,
@pj_type varchar(20),
@file_group varchar(200),
@name varchar(255),
@ext varchar(10),
@total_words int,
@dtp_pages int,
@notes varchar(500)
AS
DECLARE @file_id int,
@receive_date2 smalldatetime,
@project_id int,
@job_id int,
@group_id int
-- Check if obligatory text parameters are null
if @name is null OR @ext is null OR @pj_id is null OR @pj_type is null OR @receive_date is null
begin
return 1
end
-- Set @project_id or @job_id depending on the @pj_type [ "job" | "project" ]
if @pj_type="job" begin
set @project_id=null
set @job_id=@pj_id
end else if @pj_type="project" begin
set @project_id=@pj_id
set @job_id=null
end else begin
return 2
end
-- Check group_txt if it exists retrieve its id or create new group if it does not exist
if @file_group is not null begin
exec sp_NewFileGroup @file_group, null, @project_id, @job_id, @group_id OUTPUT
if @group_id is null begin
return 3
end
end else begin
set @group_id = null
end
-- Convert date-string format to datetime / smalldatetime
exec sp_DateConvert @receive_date, @receive_date2 OUTPUT
-- insert new row to the Files table and convert text arguments to integer values
insert into files(name, ext, receive_date, group_id, job_id, project_id, total_words, dtp_pages, file_type_id, deleted, works_count, notes)
values(@name, @ext, @receive_date2, @group_id, @job_id, @project_id, @total_words, @dtp_pages, 0, 0, 0, @notes)
set @file_id = @@identity
if @file_id is null begin
return 4
end
return 0
GO
|
|
|
|
|
You need to change the parameter declaration in your stored procedure
..
DECLARE @file_id int OUTPUT,
..
This will then return the value for you when you execute the code via ADO.
One thing to remember is that you will need to close your recordset down before you can read the value. This is only if you are not also returning a recordset
|
|
|
|
|
Hi all,
In Orcle is it possible to create a user without having the password?
If anybody knows plz tell me the procedure.
Thanx in advance.
|
|
|
|
|
I have created an excel sheet by executing a query on an external database using MS Query. Now I want the data that I have changed in the sheet to be updated back into the database from where it actually came. Is this possible? Do VB/VBScript provide any way of doing this?
Krishnan
|
|
|
|
|
Hi I want to create a simple windows that displays a message. The message would be passed to it from another application. How is this done. Any guidance would be appreciated. Is this a situation, would I use Remote procedure calls. Any help would be most appreciated.
Regards,
A Novice
|
|
|
|
|
I would like to know if the find method is the best if i want to open a field which the name is given by the user of my dlgbox application. For example, if the user write "1Y" in a edit box, my application will have to open the "1Y" field to catch value in it. So, do i have to use Find?
thanks in advance
gerald
|
|
|
|
|
Depends.
For example if the user write the EXACT text is better and more Quickly to use the command Seek, because this use the index, (you need that the field to be an index) But if the user write the no exact string how part to the string, in this case is better to use the Find.
Other solution is make a query.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Is there a performance hit if I encrypt all my database stored procedures?
|
|
|
|
|
Friends,
I'm calling an ActiveX DLL I wrote in VB from VC++. In the VB, I'm using the VB data environment to do a parameterized insert. Everything is OK until I get a duplicate key. As soon as the DataEnvironment.Commands(1).Execute statement runs, VB immeadiately returns to the C++ caller; the hResult is 0x800A0CC1, which doesn't make any sense being that the previous 812 insert suceeded. What I'm trying to do is trap the error on the VB side (using on error goto) so I can log it prior to returning to the caller. But, the error routine never runs due to the immeadiate return.
Any help will be much appriciated!
Thanks,
David Douglass
Bloomingdale, NJ
|
|
|
|
|
i have a program that connect to odbc((user DSN))
and i want to install it with installshield
i don't know that set odbc connection in install shield.
thanks
|
|
|
|
|
Can anyone suggest a report tool, add-in or something that I can use in my C++ project that tracks some basic usage data. Do most developers roll their own when they need to provide 10 or so, simple reports to screen and printer?
Any ideas would be appriciated.
Regards
Rod Hamilton
|
|
|
|
|
hi,
Does anybody know how to use SQLXML Type Library in Visual C++ programs...
I need it to do some XML-data retrieving from SQL server 7.0.Or if there is another way to use SQL Server 7.0's XML features through ADO,please let me know...
Greetings from Germany
Özgür
Bachelor of Control&Computer Engineering from IStanbul Technical University
Worked with Delphi for 6 Months
Worked with Java for 3 Months
Now ,Working with MFC,VIsual C++6.0 and ADO
|
|
|
|
|
I've got my application ready and it is running perfect under my developing computer (win95), but on an other machine (winNT) it doesn't start at all!!! No error-message is shown!
I think the proplem has to do with the control "Microsoft ADO Data Control, version 6.0 (OLEDB).lnk"
It is a matter of different paths?
"c:\windows\system\msadodc.ocx" on w95 and
"c:\winnt\system32\msadodc.ocx" on NT ?
I already use the MFC as a static lib. ADO 2.5 is installed on both computers.
Please help me!
Friedrich
|
|
|
|
|
Try to load dynamically the component... The #import <filename> is almost always a bad idea.
LoadTypeLibrary, CoCreateInstance, even old LoadLibrary can help.
Or it can be a different version control that has some methods on 95 and other on NT. Trying to call the method "7" when the interface implements only "6"...
By the way, application doesn't tell nothing? No crash, no "Debug", nothing? What does it mean "doesn't start at all"?
|
|
|
|
|
Sorry, I was not precise enough.
I didn't use the #import, I used "Project | add | Controls | Registred Active-X controls"...
(sth like that, I'm using a german visual studio)
I dragged the control with the mouse to a dialog in the dialog-editor ( and a MS-Data Grid etc )
"Nothing" means, nothing happens if i double click on the Icon in Win Explorer. Just as it wasn't there.
To Debug, i would have to install Visual sudio to the NT system. But I wanted to avoid it, cause it is always a matter: running on the development-computer is successfull, running on an other system fails:
On another NT System with Visual Studio, the application started, the starting querie succeded, but the user-queries failed (access error).
?
Thanks for your answer.
Friedrich
|
|
|
|
|
... using InstallShield. It has made a setup.exe with all things which are needed.
Thanks
Friedrich
|
|
|
|
|
Hi,
I am just a beginner in this field.I want to learn more about how to retrieve database information as XML data from SQL Server.I got the basic concept,now i need some code snippets that can let me fly.All the information that i could find on internet was for Visual Basic developers..I am working with Visual C++ and ADO and SQL Server 7.0.Can anybody show me some code or some internet sites devoted to Visual C++ developers..Also
what else,i need to be able to use XML features of SQL Server?
with greetings from Germany
Özgür
Bachelor of Control&Computer Engineering from IStanbul Technical University
Worked with Delphi for 6 Months
Worked with Java for 3 Months
Now ,Working with MFC,VIsual C++6.0 and ADO
|
|
|
|
|