|
Hi all,
I am using a Crecordset class to retrieve rows from an access database table. I am constructing the WHERE statement at runtime and pass it to CRecordset using m_strFilter. The problem is the following:
I need to query a date field in the database (rem_date) based on a date provided by the user (m_date). I am using the following code (v_filter is the where statement):
v_filter+="(rem_date=";
v_filter+="{d'";
v_filter+=m_date.Format("%Y-%m-%d");
v_filter+="'}";
v_filter+=" )";
The problem is that the above statement returns TRUE only when both the date and the (hidden) time is the same. I only need to compare the date portion. Do you know how can I do this?
I thank yuo in advance,
Christos P.
|
|
|
|
|
Do not exactly remember the function that will get you parts of the date in Access but you need to do something like:
Where DatePart( date_field, "mm-dd-yy") = DatePart( userDate, "mm-dd-yy" )
Try writing the query in Access it self first. Once you have it working you can can move it to your code by replacing the UserDate with the appropriate variable in your code.
|
|
|
|
|
Dear Ranjan BANERJI,
I would like to thank you for your reply but I feel that I have to exemplify my problem a bit more:
I am able to extract the date portion from the user-supplied date but I am not able to do the same for the date retrieved from the database.
What I need is the name of the SQL function that does this.
Thank you for your time,
Christos P.
|
|
|
|
|
Hi,
My program uses the libmysql.dll <- to access a MySQL database.
For my program to run, this dll needs to be with the program or in the system32 folder.
Is there anyway I can "Include" the DLL in my project? So I don't need to have the libmysql file laying around?
I know my program will be like 200 k bigger, but I really want to only have only one file, the EXE and not two the EXE and the libmysql.dll file
Thanks for your time.
|
|
|
|
|
Link the DLL statically to your exe. This will import all of the code into your DLL.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks for the quick answer, but how do I do that in Microsoft Visual Studio 6.0 ?
|
|
|
|
|
I did a little research, and it looks like usually you would create a static library from a new project. Or at least you could set a few command line compiler parameters for you DLL in order to make it a static library. Look up "Creating a Static Library" for more details on this.
As far as converting an existing dynamic lib file to a static file, I am not sure if this can be done or if there are tools in VC++ to do it. I would look in MSDN a little or search on Google.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I hope it can be done..
Since I don't have access to the Project on the DLL I can't compile it as a static.
|
|
|
|
|
Hello,
I am attempting to assign a "Custom" state item image to a tree view item, however, I can't find any way to do so without having to provide my drawing funtionality. What I mean by "Custom" is having an alternate state assigned. For example, the following psuedo layout is what I am trying to obtain:
-- StateBitmap (Checkbox) - CustomStateBitmap - ItemBitmap - "Tree Item Text"
Not only am I attempting to have a "Checked" and "Unchecked" state, I would also like to allow my users to right click on this tree item and select a custom state to be set for this tree item. This custom state would correspond to the "CustomStateBitmap" above and would change dynamically.
This idea is enabling a secondary, standalone custom state, which only has meaning within the context of the application I am writing.
Any help or advice would be greatly appreciated.
Thanks,
Michael
Michael D. Wallis
|
|
|
|
|
I don't think the tree view supports that many bitmaps per item.
You could combine the CustomStateBitmap and the ItemBitmap as a single bitmap, something like this:
+----------------+
| +----+ +----+ |
| | CS | | IB | |
| +----+ +----+ |
+----------------+ Visually, the single bitmap looks like two bitmaps with a clear area between. Of course, this means you would have to have a set of bitmaps, one for each possible combination of "custom state" and "item".
Gary R. Wheeler
|
|
|
|
|
Hello,
Is there a simple way to override the default selection format indication for a CListCtrl---or stop the selection from drawing? The default behavior is for the selected CListCtrl (report) item to be drawn with a dark system color while inversing the text to white. I would like to use an alternative drawing scheme to indicate that the item(s) is selected. I would rather not choose to draw the entire control myself.
thanks!
JennyP
|
|
|
|
|
It's possible to do it using Custom Draw (without drawing the whole control). Take a look at "NM_CUSTOMDRAW (list view)" in the MSDN index.
Chris Richardson
|
|
|
|
|
Why do my drop down list want to automatically scroll back up when I'm trying to scroll down?
Is there some option that I have set to do this?
Thanks for the help!
|
|
|
|
|
Thats sounds very strange...did you override OnVScroll() with SetCurSel(0) inside the fucntion...?
jimNLX wrote:
Is there some option that I have set to do this?
Not that I know of
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
This is all that I did...
CComboBox *pSelBox = (CComboBox *) GetDlgItem(IDC_SEL);
pSelBox->SetCurSel(-1);
pSelBox->SetItemHeight(2,40);
pSelBox->SetDroppedWidth(425);
Then I filled the list with a loop that adds strings..
pSelBox->AddString(desc[i]);
How can I get this thing to stop jumping around?
|
|
|
|
|
If you open a catalaog in ADOx, then a table, should you close them after you are done? THis wont close the database will it? (and destroy my member database variable )
Appreciate your help,
ns
|
|
|
|
|
Dont know...but it should not be difficult to test.
|
|
|
|
|
When you refresh the catalog, the catalog is updated. You don't need to close for make that...
Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hello,
I am trying to replace or remove strA with in strB. The problem is that I want to start removing/replacing after a index.. Is there a way to do this??
Thanks!
|
|
|
|
|
If you mean replace after a certain index in strB, then why dont you determine what the substring in strB is with the index, and create substring C and use that to replace.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
The string that needs to be modified is never the same.. I am trying to remove \par from a rich text string but only after a specific point.. here's the example..
String a;
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\cf1\fs17 Hello this is a test
\par Hello this is a snd test
\par Woot
\par \cf0
\par }
String b;
Woot
String a after the remove;
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\cf1\fs17 Hello this is a test
\par Hello this is a snd test
\par Woot
\cf0
}
I want to remove the 2 "\par "'s from string a.. but only after "Woot".
Note string a is not allways the same.. some times it has the color tag at the end and some times it doesn't.
|
|
|
|
|
Not tested, but:
void ReplaceAfterIndex(int nIndex, const CString& strOld, const CString& strNew, CString& rstrTarget)
{
while ( (nIndex = rstrTarget.Find(strOld, nIndex)) >= 0 )
{
CString strTemp;
if ( nIndex > 0)
strTemp = rstrTarget.Left(nIndex);
strTemp += strNew;
if ( nIndex + strOld.GetLength() < rstrTarget.Length()-1 )
strTemp += rstrTarget.Mid(nIndex, strOld.GetLength());
nIndex += strOld.GetLength();
}
}
Shog9
------
And on the pedestal, these words appear:
"My name is Ozymandias, King of Kings,
Look on my Works, ye Mighty, and despair!"
Nothing beside remains.
|
|
|
|
|
Give a specific example.
Kuphryn
|
|
|
|
|
Hi,
Any similar problems and/or solutions would be gratefully received!
I've got a setup (msi) made with Installer 1.1 that comes with VS6.
It works like a charm if I log in and install as administrator, but after installation when I try logging in as another user no start menu items (program group, or icons) appear in the start menu.
As well as that, on a client's machine, when other users (IE not Administrator) try our program it completely flakes out; they keep getting 'unsupported operation' when running through the program. We use both ADO as well as flexgrid, but MDAC 2.6 and the FlexGrid files are all installed.
I should note all the machines are Win2k sp3 (the client's are brand new).
Cheers,
Paul
|
|
|
|
|
Hello,
I think some of you problems could be in the install program.. When the install package creates the shortcuts all short cuts should be put into the "All Users" profile instead of the "Administrator" or currently logged in profile. 2nd.. If your install package needs to write to the system32 directory you will have to run the install as a admin (no way around it) its the same with all other apps..
Hope this helps
|
|
|
|