|
물론 맞는 말씀이시긴 한데 file2는 ConnetionString에 안쓴다는 겁니다.
그런데도 불구하고 file2=... 구문이 있는냐 없느냐에 따라 file의 최종 구문이 달라진다는게 문제지요.
여하간 밑에 ConnectionString에 대한 답변으로 해결했습니다.
감사합니다.
박지훈.임프 님이 쓰신 글 :
: file2 = ... 문장을 지우면,
: file2 포인터는 초기화가 안되어 있으니 엉뚱한 값이 들어있을 수밖에 없지요.
:
: 그럼 이만...
:
:
: webb 님이 쓰신 글 :
: : 밑에 제가 질문한것을 혼자 풀어볼라고 이래저래 하다가 황당한(?)일을 겪고 있습니다.
: :
: : 원하는대로 되긴 했지만 이해가 안갑니다.
: :
: : void __fastcall TForm1::Button3Click(TObject *Sender)
: : {
: : char* file;
: : char* file2;
: :
: : OpenDialog1->Execute();
: : file = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
: : //ADOTable2->ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
: : //Edit1->Text =ADOTable2->ConnectionString;
: : strcat(file,OpenDialog1->FileName.c_str());
: : //Edit1->Text = file;
: : //ADOTable2->ConnectionString += WideString(OpenDialog1->FileName);
: : //Edit1->Text = ADOTable2->ConnectionString;
: : //ADOTable2->ConnectionString +=";Persist Security Info=False;Extended Properties=Excel 8.0";
: : file2 =";Persist Security Info=False;Extended Properties=Excel 8.0";
: : Edit2->Text = file2;
: : strcat(file,";Persist Security Info=False;Extended Properties=Excel 8.0");
: : //Edit1->Text = file;
: : ADOTable2->ConnectionString = WideString(file);
: : Edit1->Text = ADOTable2->ConnectionString;
: : ADOTable2->TableDirect = true;
: : ShowMessage(ADOTable2->ConnectionString);
: : ShowMessage(OpenDialog1->FileName);
: : ADOTable2->Active = true;
: :
: : }
: : 중간에
: : file2 =";Persist Security Info=False;Extended Properties=Excel 8.0";
: : Edit2->Text = file2;
: : 부분을 보면 Edit2->Text는 당연히 ;Persist Security Info=False;Extended Properties=Excel 8.0 가
: : 되어야 하는데 엉뚱한 값이 나옵니다.
: : 무엇이 나오냐 하면 opendialog에서 불러들은 파일의 경로와 파일이름이 약간 변형이 되서 나옵니다.
: : 읽어들은 파일은 c:\documents and setttings\김규식\my documents\order.xls인데
: : ":\documents and setttings\김규식\my documents\order.xls:"로 표시됩니다.
: : 우째 이럴 수가 있나요?
: :
: : 그런데 더 우낀것은 일단 위 코드로 원하는대로 실행은 되나 만약 file2 = .... 문장을 지우면
: : 원하는 문장 즉,
: : Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\documents and setttings\김규식\my documents\order.xls;Persist Security Info=False;Extended Properties=Excel 8.0가 아니라
: :
: : Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\documents and setttings\김규식\my documents\order.xls:\documents and setttings\김규식\my documents\order.xls: 가 나온다는 겁니다.
: :
: : 제가 바본가요?.. 정말 이상하다...
: :
: :
|