|
Can you write Active Server Pages for a UDB backend? Is there a known white paper on this topic?
|
|
|
|
|
Of course you can. With ASP you would be using ADO to connect to the database. All that you would have to do is change the connection string so that it uses the ADO driver for UDB.
|
|
|
|
|
Has anyone got samples of how to store an image into a SQL Server database.
I'm trying to use C++ and ATL OLEDB. The accessor maps the column to as
BLOB_ENTRY(2, IID_ISequentialStream, STGM_READ, m_image)
and I can load an image using the OleLoadPicture to store it in an IPicture interface. Now I need to be able to get this into the database.
I have tried to change the map to an IStream as it inherits from ISequentialStream
BLOB_ENTRY(2, IID_IStream, STGM_READ, m_image)
then use the IPicture::SaveAsFile(m_image,...) this doesn't work because the m_image pointer is NULL to begin with.
I have tried other methods using IStream::Write, etc. but the SetData or INsert always fails.
|
|
|
|
|
I'm building a data controller module in VC 6.0 that goes against an Access 2000 database. I find that I need the capabilities that OLEDB gives me for replication, securing the DB from the outside world, etc. Since ADO is an easy to implement interface to OLEDB I need opinions on which runs faster in real life, OLEDB or ADO, and how much faster? I've heard from one associate that ADO is slower than ODBC but I need the OLEDB/ADO functionality to satisfy some of my requirements. So my question is which runs faster, ODBC, OLEDB or ADO and by how much?
Roger Cornell
|
|
|
|
|
As far as speed you can eleminate ODBC and that leaves ADO and OLEDB.
If you look at the architecture of these two you see that ADO sits on top of OLEDB ands adds a few things, like IDispatch so it can be used by scripting languages, VB and other lesser;) languages. With that said if you were writing the component in C++ you would diffenately get a performance boost using OLEDB over ADO. How much is hard to say since there are a number of factors that can influence it.
I recently had this discussion with a co-worker and he did find that OLEDB was better when using C++. It also helped improve his code when he started including .h files instead of importing entire type libraries for one interface.
|
|
|
|
|
Agree,
using OLEDB when programming in C++ improves performance (and even readability of the code). You are going more C++ native when using OLEDB than with ADO which is developed for automation programming.
Using ODBC is the fastest (I've heard...) when live and kicking, but it is a mess programming, I gave up after 10 minutes...
OLEDB is almost as easy as ADO and the wizards gives you a lot of help in the beginning...
/WW
|
|
|
|
|
I am writing an OLEDB Wrapper for my company and I've also wrote a benchmarking application to test the speeds, my results indicate that on a 2155 record table OLEDB is about 400ms faster than ADO.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Faster at doing what exactly? Making a round trip call to the database for a query or update?
Can you share the code for the benchmark application? I would be interested in seeing the performance difference.
|
|
|
|
|
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
|
|
|
|
|