|
Hi ,
I am searching for a good sample code or article that takes a tab delimited file as input and imports it prograamatically in an access database.I don't want to loop through all the records in the text file and then put them individually into access.I want to import the whole file programmatically into an MS ACCESS table.May be it requires OLE.
Any help will be appriciated.
Thanks and regards.
|
|
|
|
|
Connecting to the MDB using DAO classes and looping through the records in the CSV file and inserting them isn't that bad an idea.
I think ODBC allows a DSN to be associated with a tab delimited file. It might be workable to assign a System DSN to the tab delimited file and then you could use ODBC to move the CSV file to an Access table.
I'm going to live forever or die trying!
|
|
|
|
|
Or, simply define the text file as an ODBC DSN and create an external Link in acess. Then, you can do a standard insert/select query right in access.
onwards and upwards...
|
|
|
|
|
HI,
THANKS FOR REPLY.BUT I COULDN'T UNDERSTAND YOUR SUGGESTION
PROPERLY.WHAT DO U MEAN BY EXTERNAL LINK?HOW IT IS CREATED ,CAN U TELL ME THROUGH A SMALL SAMPLE CODE?
THANKS AGAIN.
|
|
|
|
|
I created a dll with MFC as shared library. In order for me to have different name and type of dll for each mode (debug and release), i used this code in MyDllLib.h. This file will be called by exe from stdafx.h file.
#if defined _AFXDLL
#ifdef _DEBUG
#pragma comment(lib,"MyDlld.lib")
#pragma message("Automatically linking with MyDLLd.dll")
#else
#pragma comment(lib,"MyDll.lib")
#pragma message("Automatically linking with MyDll.dll")
#endif
#endif
but whenever i compile in debug mode, i got this warning..
Linking...
Creating library ./bin/MyDlld.lib and object ./bin/MyDlld.exp
MyDlld.exp : warning LNK4070: /OUT:MyDll.dll directive in .EXP differs from output filename "./bin/MyDlld.dll"; ignoring directive
it doesn't have any problem in the release mode... can anybody tell me why this is happenning..
One more thing, when compile in debug mode, my exe will search for release mode of MyDll.dll and not debug mode (MyDlld.dll)...
Thanks in advance
|
|
|
|
|
Hum.. Seems like you will have to change the output names in your project settings...
~RaGE();
|
|
|
|
|
my setting in the output setting is.. MyDll.dll for release mode and MyDlld.dll for debug mode...
|
|
|
|
|
You probably have a module-definition (.def) file which has a LIBRARY statement in it.
The LIBRARY statement is actually unnecessary, you can simply remove it.
--
Mike Dimmick
|
|
|
|
|
Does this means that my dll do not have any problems?
How about the second question? my Exe (in debug mode) still looking for MyDll.dll (release version) and not the debug version.. aaahhhh,...
|
|
|
|
|
I m developing a whiteboard program.
I need to implement text drawing on a view as in Win Paintbrush.
Could anyone give me some suggestion?Some sample code is better.
Thanks
|
|
|
|
|
A good basis for something like this would be the SCRIBBLE sample program that comes with MSDN.
You could have a toolbar which switches between graphic modes. In Text mode, you can detect a
OnLButtonUp event in your view and pop a box asking for text.
There are plenty of text input dialog boxes here on CodeProject you could use. And its not hard
to get ClassWizard to make a dialog box with an edit box in it for you. If you are clever, you
could handle EN_CHANGE notifications from the edit box and live-update the view with the text
you are typing in.
For drawing the resultant text, just use
pDC->DrawText (...) function.
I hope that helped,
Iain.
|
|
|
|
|
Thanks!!
With your reply ,I get the way to solve my question!
Just 3 type as you said, right?
1. make a resource to tell my view that i will draw text on it
2. catch LBUTTONUP message and pop a edit box
3. Notify the view and DrawText
baybe it ll take me sometime to solve it.Anyway, thanks for your advise!
|
|
|
|
|
I would do this in the following order:
Forget about the UI to start with, amd simply practice drawing text into the View at a hard
coded place. This will let you learn about CFont, pDC->SelectObject, pDC->SetTextBkMode,
pDC->TextOut / pDC->DrawText.
Then make a toolbar so you can switch between graphic modes (pen, line, text, etc).
Create Command Handlers for them, so the button / menu for the current tool is inset / ticked.
Then in your mouse button handler, pop up a box to input some text. Add the text and its
coordinates (from the mouse position) to a list of some kind in your CMyDocument. Redraw
the screen with the new text.
Relax in a warm glow of achievement. Have a or to taste.
Iain.
|
|
|
|
|
Class CA
{
protected:
CA();
private:
int a;
int b;
CRect c;
}
CA::CA():c(0,0,100,100){
a=0;
b=0;
}
What's the difference between both of the initialization ways in function "CA()"?
Thank you in advance!
|
|
|
|
|
The initialisation list you used with you variable c is executed before the constructor is even called - it is part of the allocation of the instance.
But on the other hand, you have to be careful: The initialisation list does not care about the order in which you placed them - the are executed in the order the variables are allocated (declared). After all, initialisation lists are part of the allocation.
OTOH, a and b are of undefined value before they get assigned a value. (and they need an assignment operator able to cope whith the values they got assigned - initialisation lists do not.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Thank you!
|
|
|
|
|
Is there a way to increase the font size in a console application? A larger text would be nicer to read.
Thanks, Dave
VC++ 6.0
|
|
|
|
|
Simple answer, no.
The user can change the console settings themselves, (font, number of columns, rows etc), but the
console takes what is given. If a spiffy UI is what you want, console is not the way to go...
I *believe* you can stream out escape characters to make parts of your text bold, but I'm not too
sure.
Iain.
|
|
|
|
|
I guess that you could configure your console font size in windows if i am not mistaken.
|
|
|
|
|
Thanks
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
Is there a way to set a console application to open "full screen" when it is built as a final release? I know you can right click and go to "properties" to set the window to full screen, but can I enter some code to permanently do the same thing? Thanks.
VC++ 6.0
|
|
|
|
|
Use GetConsoleDisplayMode to see if the window needs to change and if it does send Alt-Enter to the consol window. Thats the only way I know. I havent seen any API that changes the fullscreen mode of a consol window.
Magnus
|
|
|
|
|
I'm working on the program below. It sorts numbers fine, but it only lets me sort ONE number. I want to have the option to either choose to enter another search or quit. I'm not sure how to setup the program to repeat the search. How can I accomplish this. Thanks, Dave.
<br />
<br />
#include <iostream><br />
#include <cstdio><br />
using namespace std;<br />
<br />
int main()<br />
<br />
{<br />
int x;<br />
int i;<br />
char str[80];<br />
char Info [] [300] = <br />
{<br />
"3030-02-000-5287" , "Here is the information for this number."<br />
"3030-03-000-0029" , "Here is the information for this number."<br />
};<br />
<br />
cout<<"Please enter a number:\n";<br />
cin>>str;<br />
<br />
for(i=0; i < 4; i += 2)<br />
if(!strcmp(str, Info[i]))<br />
{<br />
cout<<"Information:"<<Info[i+1]<<"\n";<br />
break;<br />
}<br />
<br />
{if(i == 4)<br />
cout<<"Number not found.\n";<br />
}<br />
<br />
{cout<<"\nWould you like to check another?\n";<br />
cout<<"Enter 1 for yes, 0 for no.\n";<br />
cin>>x>>"\n";}<br />
<br />
<br />
return 0;<br />
}<br />
<br />
-----------------------------------------------------
VC++ 6.0
|
|
|
|
|
int main()
{
int x;
int i;
char str[80];
bool isfinished=false;
char Info [] [300] =
{
"3030-02-000-5287" , "Here is the information for this number."
"3030-03-000-0029" , "Here is the information for this number."
};
while(isfinished==false)
{
cout<<"Please enter a number:\n";
cin>>str;
for(i=0; i < 4; i += 2)
if(!strcmp(str, Info[i]))
{
cout<<"Information:"<<Info[i+1]<<"\n";
break;
}
if(i == 4)
{
cout<<"Number not found.\n";
}
x=-1;
cout<<"\nWould you like to check another?\n";
while(x!=0 && x!=1)
{
cout<<"Enter 1 for yes, 0 for no.\n";
cin>>x>>"\n";
}
if (x==0)
isfinished=true;
}
return 0;
}
~RaGE();
|
|
|
|
|
I get the following message Rage when I run the code:
Compiling...
rage.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\Rage NSN Lookup\rage.cpp(22) : error C2065: 'strcmp' : undeclared identifier
Error executing cl.exe.
-----------------------------------------------------
it's this line below:
if(!strcmp(str, Info[i]))
-----------------------------------------------------
Rage NSN Lookup.exe - 1 error(s), 0 warning(s)
VC++ 6.0
|
|
|
|