|
Perhaps you should have something like:
SQL_C_DOUBLE decimaldigit;<br />
SQLBindCol(hstmt, 9, SQL_C_DOUBLE, &decimaldigit, 0, &decsize);
|
|
|
|
|
SQL_C_DOUBLE is defined as 8. So I used
SQLDOUBLE decimaldigit;
SQLBindCOl ( hstmt, 9, SQL_C_DOUBLE, &decimaldigit, 0, &decsize );
For the double column the decimaldigit value is 0.000000000 and decsize it is -1.
I am confused. Even the MSDN docs tell me to use the function this way
|
|
|
|
|
I have never been a fan of SQLColumns.... usually I just do a 'select * from <tablename> where 1=0' and use the following fcns to get metadata (sorry for the code bloat...):
short DBStatement::GetColDBType(int iColumnNum)
{
short iStatus;
char caDummy[2];
short iDummy;
long lColType = -1;
if (m_hStmtHdl)
{
ResetError();
iStatus = ::SQLColAttributes(m_hStmtHdl,(UWORD)iColumnNum,(UWORD)SQL_COLUMN_TYPE,(PTR)caDummy,(SWORD)1,(SWORD *)&iDummy,(SDWORD *)&lColType);
if (iStatus != SQL_SUCCESS && iStatus != SQL_SUCCESS_WITH_INFO)
{
UpdateDBError();
lColType = -1;
}
}
else
NoActiveStatement();
return (short)lColType;
}
LPSTR DBStatement::GetColName(int iColumnNum)
{
short iStatus;
long lDummy;
short iDummy;
InitDataBuffer();
if (m_hStmtHdl)
{
ResetError();
iStatus = ::SQLColAttributes(m_hStmtHdl,(UWORD)iColumnNum,(UWORD)SQL_COLUMN_NAME,(PTR)m_caDataBuf,(SWORD)1000,(SWORD *)&iDummy,(SDWORD *)&lDummy);
if (iStatus != SQL_SUCCESS && iStatus != SQL_SUCCESS_WITH_INFO)
{
UpdateDBError();
m_caDataBuf[0] = 0;
}
}
else
NoActiveStatement();
return m_caDataBuf;
}
long DBStatement::GetColWidth(int iColumnNum)
{
short iStatus;
char caDummy[2];
long lColWidth = -1;
short iDummy;
if (m_hStmtHdl)
{
ResetError();
iStatus = ::SQLColAttributes(m_hStmtHdl,(UWORD)iColumnNum,(UWORD)SQL_COLUMN_LENGTH,(PTR)caDummy,(SWORD)1,(SWORD *)&iDummy,(SDWORD *)&lColWidth);
if (iStatus != SQL_SUCCESS && iStatus != SQL_SUCCESS_WITH_INFO)
UpdateDBError();
}
else
NoActiveStatement();
return lColWidth;
}
int DBStatement::GetNumCols()
{
short iStatus;
short iRetval = -1;
if (m_hStmtHdl)
{
ResetError();
iStatus = ::SQLNumResultCols(m_hStmtHdl,(short *)&iRetval);
if (iStatus != SQL_SUCCESS && iStatus != SQL_SUCCESS_WITH_INFO)
UpdateDBError();
}
else
NoActiveStatement();
return (int)iRetval;
}
|
|
|
|
|
The point being that you can develop a generic function to return your metadata using the SQLColAttributes ODBC call.
|
|
|
|
|
Hi guys
Somebody knows how to add the tooltip feature to the CLabel class that is here in Codeproject (SledgeHammer did this class). I've tried a solution but it doesn't work.
Best Regards
Dr.Pi
|
|
|
|
|
Hi guys
I've got an SDI app and from the View window I call a Modal Dialog.
When this dialog opens, the underneath view is not refreshed (all text is unreadable).
What I have to do to repaint the view meantime I am in the modal dialog?
Best Regards
Dr.Pi
|
|
|
|
|
One solution is Invalidate().
Kuphryn
|
|
|
|
|
I've got the same thing with one of my SDI apps, but it works fine. What styles are you using to create the dialog with?
|
|
|
|
|
Hi David
My styles are
Style : Child
Border : None
Nothing more checked in this dialog.
Hi Kuphryn
Where I have to put the Invalidate() meantime I am in the modal dialog?
Bsst Regards
|
|
|
|
|
Just for grins, change the style to Popup and see what happens.
|
|
|
|
|
Hi guys
I've discovered part of the problem.
I'm using CLabel class and when is repainted when the modal dialog is open the values are centered instead that left aligned amd made me thing that I had a repaint problem.
I don't know where could be the problem. I'll try to find.
Thanks
Dr.Pi
|
|
|
|
|
It sounds like you are using a CListView. If that is the case, you can change the alignment (e.g., LVCFMT__LEFT) when you are adding the columns.
|
|
|
|
|
I'm searching for an example of how to detect all the cameras and scanners attached to a PC (preferably serial and USB but I'll settle for USB only) I've tried using the STI and WIA apis, and those work, but there are two problems. One, they each support only a couple of OS versions, and I'd like something that works 98 through XP. Two, they only detect devices that export a TWAIN interface.
I want to get the name of each device. I did find some code that walks the USB bus, but there didn't seem to be a way to distinguish among returned devices.
Is there a good way to accomplish this that would work for Win 98 and on? Thanks.
|
|
|
|
|
|
Ryan S Roberts wrote:
You can use directshow to enumerate AV capture devices(If their drivers are WDM complient.)
It also finds VFW Devices
|
|
|
|
|
I am trying to overide some functions in CPropertySheet. I created a CPropertySheet derived class and added it to my project. when I do this in the main program, everything is cool:
//in main.cpp
CMyPropertySheet m_sheet(IDS_CODE);
m_sheet.AddPage(&entry);
m_sheet.AddPage(&approach);
But if I delare the object in the header, like this I get errors:
//in main.h
CMyPropertySheet* m_sheet;
//in main.cpp
m_sheet = new CMyPropertySheet(IDS_CODE);
m_sheet.AddPage(&entry);
m_sheet.AddPage(&approach);
Errors I get are:
error C2228: left of '.AddPage' must have class/struct/union type
I am assuming that the error is in the way I am trying to declare the CMyPropertySheet object, but I cant think of any other way. What am I doing wrong?
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
in the first way you use directly an object, and in the second method you use a pointer to an object...
Then your problem should be solved by changing m_sheet.AddPage(&entry); for m_sheet->AddPage(&entry);
it's an usual mistake...
take a look at the error: error C2228: left of '.AddPage' must have class/struct/union type if what is in the left of the member (method, function or variable) is a class, a union or a struct you will need the "." elsewhere you'll need the "->".
hope this helps.
|
|
|
|
|
Got it, thanks!
I learned all of my object-oriented programming in Java, still trying to work out all the subtle differences. Thanks.
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
That happens to all of us... subtle differences are evil!
you are welcome!
|
|
|
|
|
This question concerns the VS 6.0 IDE environment.
I am working on a rather large project. One convenient thing is that
a separate (console) project contains several classes that we wish to
use in the larger project. Therefore we are looking for a way to (easily)
import these (console) classes into the larger project (SolverGUI).
Can I create the new project (call it SolverGUI) using the MFC appwizard and then go to Project-Insert Project into Workspace and insert the console project into the SolverGUI project? This is possible, I know, but after doing that, can I use the classes in SolverConsole in SolverGUI? Is it as simple as declaring the header files in SolverGUI where I want to use the console classes, or do I have to add new classes to SolverGUI to use them?
ie: Is communication between projects possible?
|
|
|
|
|
Sounds like you need to wrap the common classes between the console/GUI app into a library or DLL. You can then build this and get your console/GUI versions to link to the lib/dll. This should also keep both projects upto date with the common code base, as changing one, changes the other.
Inserting a project into the current workspace only lets you switch between them. You can set build dependencies so that everything gets built in the right order etc.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
That clarifies things greatly. I think I will take this approach.
Thank you.
|
|
|
|
|
i keep getting this error,, how can I fix it?
I have the follwing function defined as public in the View class.
Void LoadBitmap (CString file);
and I get an error saying : missing storage-class or type specifiers
help me out
Ehsan Behboudi
|
|
|
|
|
Could it be that you've got to write void instead of Void ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
you are THE MAN,,,,
Ehsan Behboudi
|
|
|
|