|
Yep. that too
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
You set that in the constructor of your property sheet class - as one of the parameters to the constructor of the CPropertySheet class (the first one, i think from memory).
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Edit: fixed! thanks guys.
|
|
|
|
|
I am using ADO to connect to MS_SQL database.
I need to retrieve the columns for a specific stored procedure in this database.
I tried the OpenSchema method with adSchemaProcedureColumns as QueryTpe but an error "Object or provider is not capable of performing requested operation" occurs.
These are the lines of codes that generates the error:
// Establish connection
ADODB::_ConnectionPtr MyConnection = NULL;
MyConnection .CreateInstance(__uuidof(ADODB::Connection));
MyConnection ->ConnectionString = _bstr_t (ConnectionString);
MyConnection ->Open(_bstr_t (L""),_bstr_t (L""), _bstr_t (L""), -1);
ADODB::_RecordsetPtr MySchema = NULL;
MySchema = MyConnection->OpenSchema(ADODB::adSchemaProcedureColumns);
How can i get rid of this error and retrieve the stored procedure.
Is there a solution to get rid of this error? or may be another method that can be used.
|
|
|
|
|
I don't know how/if you can do that with ADO. Since you're using sql server, there are a bunch of methods you can use to retrieve this information though.
You can use the system tables to retrieve information:-
select * from sysobjects o
join syscolumns c on c.id=o.id where o.name='p_YourProcName'
Alternatively, retrieve more wholesome information with the sp_help procedure.
sp_help 'p_YourProcName'
Personally, I prefer using the direct sql method with the system tables. For two reasons. 1) SQL Query Analyser colours the object names a pleasing shade of green, and 2) It creates potentially very lucrative future compatibility "problems".
Find more info about System Stored Procs in SQL2k at http://msdn.microsoft.com/library/en-us/tsqlref/ts_sp_00_519s.asp
Ta,
Jon
#include <beer.h>
|
|
|
|
|
I tried the above procedures but they retrieve the stored procedure parameters not the columns names.
|
|
|
|
|
i use stored procedures ,
you could try it like this, it works for me.
hope this helps
si
CString strSQL;
strSQL.Format("exec all_students '"+StartDate+"' , '"+EndDate+"'");
_variant_t vstrSQL;
vstrSQL.ChangeType(VT_BSTR);
vstrSQL = strSQL;
m_pDoc= GetDocument();
cpSet.CreateInstance(__uuidof(Recordset));
cpSet->Open(vstrSQL,m_pDoc->cpDb.GetInterfacePtr),adOpenDynamic,adLockOptimistic,adCmdText);
while(!cpSet->adoEOF)
{
cpSet->MoveNext();
}
cpSet->Close();
|
|
|
|
|
I guess this works fine but it retrieves the data from a stored procedure.
What i need is to retrieve the columns names and their type.
Any Ideas?!
|
|
|
|
|
add this into a stored procedure and the call it like i mentioned
in my answer before
DECLARE @TableName VarChar(50)
DECLARE @NumRows int
SELECT @NumRows = 3
SELECT @TableName = 'mytable'
SELECT COL_NAME(OBJECT_ID(@TableName),ORDINAL_POSITION) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = @TableName AND ORDINAL_POSITION <= @NumRows
hope this helps
si
|
|
|
|
|
I cannot change what is written inside the Stored Procedure, so i guess this way wont help me.
I found a solution but don't know if it is the best one. I exected the command of type Stored procedure and form the recordset returned i was wable to retrieve the fields information.
To overcome the retrieving of a long recordset i used "SET ROWCOUNT 1" before executing the command.
If anyone has better way plz tell..
Thanks
|
|
|
|
|
I don't use MS_SQL database but I have been using ADO a lot lately, and usually when you get an error such as yours, it means that you are sending the wrong request to the database (i.e. syntax is not correct, wrong parameters, etc). Hopefully, the other replies solve your problem, but I posted this message just in case they don't.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hello,
Is CFile strong enough to allow a copy through a network connection (WAN) with some slow performance ?
Should I look to another solution ?
Thanks for your advices.
Pierre
|
|
|
|
|
Broker2003 wrote:
Is CFile strong enough to allow a copy through a network connection (WAN) with some slow performance ?
Yes, you shouldn't have any problems at all.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
well i used CFiles to do copying in a network, that was very slow, (300MBytes in three hours!!) and it worked ok. The only one being upset was the customer, because the net installation was expensive. So I think it should be ok to use CFiles in WAN too.
Regards
G. Steudtel
|
|
|
|
|
Hello,
I want to create a toolbar with a combobox in it and to detect when the combobox is updated !!!
toolbarFont.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
toolbarFont.LoadToolBar(IDR_TOOLBARFONT);
toolbarFont is a CToolbar object;
I have created some buttons in toolbar (ID_BUTTONFONTSTYLE for example) and then :
nIndex = toolbarFont.GetToolBarCtrl().CommandToIndex(ID_BUTTONFONTSTYLE);
toolbarFont.SetButtonInfo(nIndex, ID_BUTTONFONTSTYLE, TBBS_SEPARATOR, 150);
toolbarFont.GetToolBarCtrl().GetItemRect(nIndex, &rect);
rect.top = 1;
rect.right = 400;
rect.bottom = rect.top + 250;
comboFontStyle.Create(CBS_DROPDOWNLIST | CBS_SORT | WS_VISIBLE |
WS_TABSTOP | WS_VSCROLL, rect, &toolbarFont, ID_BUTTONFONTSTYLE);
everything works fine but how do I catch an event from the combobox ???
or any other ideea how to create it... ?
thanks !
|
|
|
|
|
You should be able to catch the combo box messages inside your frame class just like any other menu/toolbar message. You may not be able to use ClassWizard to do it, so you might have to edit the code manually.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hello,
I have a function that needs to write a fixed-size memory buffer to a binary file.
There are many windows functions which I could use ot write files, however I am only concerned with the fastest one.
Does anyone know which is the fastest function for writing a buffer to a file?
C++, W2K, XP
Thanks
Jeremy Pullicino
C++ Developer
Homepage
|
|
|
|
|
Jeremy Pullicino wrote:
Does anyone know which is the fastest function for writing a buffer to a file?
Fastest in the sense of actually writing the data, or returning control to your program the fastest?
For returning control to your program the fastest, WriteFileEx() using asynchronous (overlapped) I/O is about as quick as you can get. For actually writing the data, I'm not sure that there is much difference between the functions. You can use FlushFileBuffers() to force Windows to write the data to disk immediately rather than wait until later, if that's what you want.
Hope this helps a bit,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
For actually writing the data, I'm not sure that there is much difference between the functions.
There really is no difference. In the long run they all call the WIN32 api calls WriteFile(), OpenFile()... These functions operate on the file cache. If you are worryied about cpu cycles this is not really a problem because the disk is orders of magnitude slower than the cpu or memory so your choice does not make much difference.
John
|
|
|
|
|
Hello,
I posted a question a while back about going from Windows 2000 to XP and getting dll errors. I've come to the conclusion that the project was written in version 7.0 while I have version 7.1 of Visual Studio. Yes, turning the porject to a non-debug version will solve the missing dll errors (because the dll's are associated with the debug library). However, I wish to work with the projects in debug form. Is there a way to guarantee that all my projects are on the same version? Does .Net install a different core version depending on the install type you choose? Thanks.
|
|
|
|
|
Hello friends,
i am having a small query for all of us. i am having a Wizard sheet - 97 based application. Now i am having a banner i.e the header bitmap on the property sheet changes it color to black and white or it looses the proper color display if the windows display setting is set to 256 color. the bitmap is loosing the resolution can any one help me to initialise my own palette or bursh with help of which the bitmap can be drawn. if any one has dones such thing please do help me.
Thanx
TAKE CARE
|
|
|
|
|
I was just wondering if anyone knows how to quickly calculate very large exponents. I am playing around with some RSA encryption, but calculating a number raised to some 30 digit number takes a long time (in fact, I still have yet to see it finish). I've also looked a bit for the code that does the Pow() function, but I can't find it. Anyhow, is there a faster way to do this?
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
hi,
the fastet way would be the logarhithmic one. But I fear that during the conversion processes some significant digits might get lost. But I will be good for estimates.
The next approach will be, by using the fact, that the power is cumulative.
e.g.
3 raised to the power of 8 = 3 raised 4 * 3 raised 4 = 3 raised 2*... an so on.
a= 3;
a= a*a (=9)
a= a*a (=81)
a= a*a (=6561)
a= a*a (=43046721)
a= a/3 (=14348907) = 3 raised to the power of 15
Maybe this is a solution for making very large numbers?
Regards
G. Steudtel
|
|
|
|
|
Thank you very much! I think I see how I'll be doing it now!
Selevercin
If you have a problem with my spelling, just remember that's not my fault. I (as well as everyone else who learned to spell after 1976) blame it on Robert A. Kolpek for U.S. Patent 4,136,395.
|
|
|
|
|
Hello,
I'm writing a program and i'm using Excel automation in my program.
I opend an excel document (sample.xls) with Workbooks::Open() function and now i wanna get access to document's cells.
But i don't know how to initial _Workbook object with my current excel document (sample.xls) !
I took a look at MSDN and excel automation samples, and i just found this:
Workbooks books;
_Workbook book;
LPDISPATCH lpDisp;
.
.
.
lpDisp = books.Add( covOptional );
book.AttachDispatch( lpDisp );
In this sample, the programmer first makes a new document and then uses of it.
But i don't want to do it and i just want to get handle of opened document.
Regards,
Hadi
|
|
|
|