C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[5255] 다시 올립니다. 한번 보시고용..조언좀..해주시면 감사르.(고수님들 아실텐데)
시빌더사냥꾼 [] 2838 읽음    2001-02-07 17:43
Unit.hpp
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
String state, idname, pass;
String strData;
char Data[10], Data2[10], Data3[10];



__fastcall TestThread::TestThread(bool CreateSuspended)
           :TThread(CreateSuspended)
{
    Priority = tpTimeCritical;
}

void __fastcall TestThread::Execute()
{
        char *TotalData;

        int strLength;
        int i, j, k, t;

        strLength = strData.Length();
        TotalData = new char (strLength+1);
        strcpy(TotalData, strData.c_str());
        TotalData[strLength+1]='\0';

        for (i=0, j=0; TotalData[i] != '|' ; i++, j++)
        {
                Data[j] = TotalData[i];
        }
        Data[j] = '\0';
        state = Data;

        i++;

        for (k = 0 ; TotalData[i] != '|' ; i++, k++)
        {
                Data2[k] = TotalData[i];
        }
        Data2[k] = '\0';
        idname = Data2;

        i++;

        for (t = 0 ; TotalData[i] != '|' ; i++, t++)
        {
                Data3[t] = TotalData[i];
        }
        Data3[t] = '\0';
        pass = Data3;

        delete TotalData;
}


//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    AnsiString Where="where";
    AnsiString And="and";
    AnsiString id="id='" + Edit1->Text+"'";
    AnsiString pass="pass='" + Edit2->Text+"'";
    AnsiString email="email='" + Label3->Caption+"'";

    Query1->Close();
    Query1->SQL->Clear();
    Query1->SQL->Add("select * from dbo.member");

    if((Edit1->Text !="") || (Edit2->Text !="") || (Label3->Caption !=""))
    {
       Query1->SQL->Add(Where);

       if(Edit1->Text !="")
       {
           Query1->SQL->Add(id);
           Query1->SQL->Add(And);
       }

       if(Edit2->Text !="")
       {
           Query1->SQL->Add(pass);
           Query1->SQL->Add(And);
       }

       if(Label3->Caption !="")
       {
           Query1->SQL->Add(email);
           Query1->SQL->Add(And);
       }

       Query1->SQL->Delete(Query1->SQL->Count -1);
    }

    Query1->Open();
}
//---------------------------------------------------------------------------



void __fastcall TForm1::ServerSocket1ClientRead(TObject *Sender,
      TCustomWinSocket *Socket)
{
      strData = Socket->ReceiveText();

      stThread = new TestThread(false);


      state = Data;
      idname = Data2;
      pass = Data3;

      Edit1->Text = idname;
      Edit2->Text = pass;
      Label3->Caption = state;


}
//---------------------------------------------------------------------------
Unit.h

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Db.hpp>
#include <DBGrids.hpp>
#include <DBTables.hpp>
#include <Grids.hpp>
#include <ScktComp.hpp>
//---------------------------------------------------------------------------
class TestThread: public TThread
{
    private:
    protected:
        void __fastcall Execute();
    public:
        __fastcall TestThread(bool CreateSuspended);
};
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE-managed Components
        TPanel *Panel1;
        TEdit *Edit1;
        TEdit *Edit2;
        TButton *Button1;
        TShape *Shape1;
        TLabel *Label1;
        TLabel *Label2;
        TStaticText *StaticText1;
        TDataSource *DataSource1;
        TQuery *Query1;
        TDBGrid *DBGrid1;
        TServerSocket *ServerSocket1;
    TLabel *Label3;
        void __fastcall Button1Click(TObject *Sender);
    void __fastcall ServerSocket1ClientRead(TObject *Sender,
          TCustomWinSocket *Socket);
private:    // User declarations
       
public:        // User declarations
        TestThread *stThread;
       
        __fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

이 부분에서 로그인으로 접속의 확인 절차를 받으면

서버쪽의 Label3에 id, pass 숨은 label삼에 login
이라고 나옵니다.
그런데 Proccess 에러가 나오는 군요..

참고로....다시 서버측에서에 검색된 db의 값을...
로그인한 사용자에게 환영합니다. 이런식으로
송신을 해주고 싶은데 이 방법은 어떻게 처리를 해야하는 지..

+ -

관련 글 리스트
5237 이건 어떻게 스레드를 처리를 해야하는지? (고수님들 아실텐데) 시빌더사냥꾼 2771 2001/02/06
5243     Re:이건 어떻게 스레드를 처리를 해야하는지? (고수님들 아실텐데) 박지훈.임프 2982 2001/02/07
5255         다시 올립니다. 한번 보시고용..조언좀..해주시면 감사르.(고수님들 아실텐데) 시빌더사냥꾼 2838 2001/02/07
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.