Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Dll function not inserting ths data [modified]

Dll function not inserting ths data [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
15 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    With_problem
    wrote on last edited by
    #1

    i am using this code for inserting the data...and iam using oledb consumer wizard to make connection....can any body point out what is the problem here...it always get user define run time error..."Error inserting the record"...after calling dll function...any help

    typedef int (CALLBACK* Set_Quote_DB)(unsigned short**,short*,unsigned short**,unsigned short**,unsigned short**,short*);

    void CArielProjectVer2Dlg::OnPriceChangeArielapictrl1(LPCTSTR SessionId, LPCTSTR RequestId, short MarketNo, LPCTSTR Market, LPCTSTR Bid, short BidDirection, LPCTSTR Ask, short AskDirection, LPCTSTR High, LPCTSTR Low, short MarketState, LPCTSTR Timestamp)
    {
    // TODO: Add your control notification handler code here
    // for dll call

    HINSTANCE hInstance=LoadLibrary("WartzODLCOM.dll");
    Set\_Quote\_DB SetQuote;
    SetQuote = (Set\_Quote\_DB)GetProcAddress(hInstance,"setQuoteToDb");
    
    
    SessID=SessionId;
    CurrentRequestId=RequestId;
    txtMarket = Market;
     
    marketno.Format("%d",MarketNo);
    bid\_d.Format("%c",BidDirection);
    ask\_d.Format("%c",AskDirection);
    marketstate.Format("%d",MarketState);
    
    
    m\_MainEdit=m\_MainEdit + "" SessionId +  RequestId + marketno ; 
    m\_MainEdit=m\_MainEdit + Market  + Bid  + bid\_d +  Ask + ask\_d  High ;
    m\_MainEdit=m\_MainEdit + Low +  marketstate +  Timestamp ;
    

    UpdateData(FALSE);
    iLineCount=m_EditCtrl.GetLineCount();
    m_EditCtrl.LineScroll(iLineCount);

    USES\_CONVERSION;
    BSTR bsTimeStamp = A2BSTR(Timestamp);
    BSTR bsMarket =  A2BSTR(Market);
    BSTR bsBid = A2BSTR(Bid);
    BSTR bsAsk = A2BSTR(Ask);
    

    // CALLING DLL FUNCTION
    HRESULT hResult = SetQuote(&bsTimeStamp,&MarketNo,&bsMarket,&bsAsk,&bsBid,&MarketState);
    if(FAILED(hResult))
    {
    AfxMessageBox(_T("Error inserting record"));
    return;
    }
    else
    {
    MessageBox(_T("data entered" ));
    }

    	SysFreeString(bsTimeStamp);
    SysFreeString(bsMarket);
    SysFreeString(bsBid);
    SysFreeString(bsAsk);
    
    FreeLibrary( hInstance );
    UpdateData(FALSE);
    

    }

    T 1 Reply Last reply
    0
    • W With_problem

      i am using this code for inserting the data...and iam using oledb consumer wizard to make connection....can any body point out what is the problem here...it always get user define run time error..."Error inserting the record"...after calling dll function...any help

      typedef int (CALLBACK* Set_Quote_DB)(unsigned short**,short*,unsigned short**,unsigned short**,unsigned short**,short*);

      void CArielProjectVer2Dlg::OnPriceChangeArielapictrl1(LPCTSTR SessionId, LPCTSTR RequestId, short MarketNo, LPCTSTR Market, LPCTSTR Bid, short BidDirection, LPCTSTR Ask, short AskDirection, LPCTSTR High, LPCTSTR Low, short MarketState, LPCTSTR Timestamp)
      {
      // TODO: Add your control notification handler code here
      // for dll call

      HINSTANCE hInstance=LoadLibrary("WartzODLCOM.dll");
      Set\_Quote\_DB SetQuote;
      SetQuote = (Set\_Quote\_DB)GetProcAddress(hInstance,"setQuoteToDb");
      
      
      SessID=SessionId;
      CurrentRequestId=RequestId;
      txtMarket = Market;
       
      marketno.Format("%d",MarketNo);
      bid\_d.Format("%c",BidDirection);
      ask\_d.Format("%c",AskDirection);
      marketstate.Format("%d",MarketState);
      
      
      m\_MainEdit=m\_MainEdit + "" SessionId +  RequestId + marketno ; 
      m\_MainEdit=m\_MainEdit + Market  + Bid  + bid\_d +  Ask + ask\_d  High ;
      m\_MainEdit=m\_MainEdit + Low +  marketstate +  Timestamp ;
      

      UpdateData(FALSE);
      iLineCount=m_EditCtrl.GetLineCount();
      m_EditCtrl.LineScroll(iLineCount);

      USES\_CONVERSION;
      BSTR bsTimeStamp = A2BSTR(Timestamp);
      BSTR bsMarket =  A2BSTR(Market);
      BSTR bsBid = A2BSTR(Bid);
      BSTR bsAsk = A2BSTR(Ask);
      

      // CALLING DLL FUNCTION
      HRESULT hResult = SetQuote(&bsTimeStamp,&MarketNo,&bsMarket,&bsAsk,&bsBid,&MarketState);
      if(FAILED(hResult))
      {
      AfxMessageBox(_T("Error inserting record"));
      return;
      }
      else
      {
      MessageBox(_T("data entered" ));
      }

      	SysFreeString(bsTimeStamp);
      SysFreeString(bsMarket);
      SysFreeString(bsBid);
      SysFreeString(bsAsk);
      
      FreeLibrary( hInstance );
      UpdateData(FALSE);
      

      }

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      please edit your message, and change the <code> tags with <pre>. thanks


      Don't know where to start ?
      Refer the Forums Guidelines and ask a friend

      [VisualCalc 3.0][Flags Beginner's Guide]

      R T 2 Replies Last reply
      0
      • T toxcct

        please edit your message, and change the <code> tags with <pre>. thanks


        Don't know where to start ?
        Refer the Forums Guidelines and ask a friend

        [VisualCalc 3.0][Flags Beginner's Guide]

        R Offline
        R Offline
        Rajesh R Subramanian
        wrote on last edited by
        #3

        toxcct wrote:

        posting police

        LOL :-D


        Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

        T 1 Reply Last reply
        0
        • R Rajesh R Subramanian

          toxcct wrote:

          posting police

          LOL :-D


          Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          hey, that's not funny ! we have posting guidelines[^], but nobody respect them :doh:


          Don't know where to start ?
          Refer the Forums Guidelines and ask a friend

          [VisualCalc 3.0][Flags Beginner's Guide]

          H K 2 Replies Last reply
          0
          • T toxcct

            hey, that's not funny ! we have posting guidelines[^], but nobody respect them :doh:


            Don't know where to start ?
            Refer the Forums Guidelines and ask a friend

            [VisualCalc 3.0][Flags Beginner's Guide]

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            toxcct wrote:

            nobody respect them

            except professional members :)


            WhiteSky


            1 Reply Last reply
            0
            • T toxcct

              please edit your message, and change the <code> tags with <pre>. thanks


              Don't know where to start ?
              Refer the Forums Guidelines and ask a friend

              [VisualCalc 3.0][Flags Beginner's Guide]

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              toxcct wrote: posting police What about Posting Police Gang

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

              T 1 Reply Last reply
              0
              • T ThatsAlok

                toxcct wrote: posting police What about Posting Police Gang

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                ThatsAlok wrote:

                What about Posting Police Gang

                :~ so you think advising people to follow CP rules is that bad ? what about Posting Crap Gang, which is very influent thoses days ? :suss:


                Don't know where to start ?
                Refer the Forums Guidelines and ask a friend

                [VisualCalc 3.0][Flags Beginner's Guide]

                R T E 3 Replies Last reply
                0
                • T toxcct

                  ThatsAlok wrote:

                  What about Posting Police Gang

                  :~ so you think advising people to follow CP rules is that bad ? what about Posting Crap Gang, which is very influent thoses days ? :suss:


                  Don't know where to start ?
                  Refer the Forums Guidelines and ask a friend

                  [VisualCalc 3.0][Flags Beginner's Guide]

                  R Offline
                  R Offline
                  Rajesh R Subramanian
                  wrote on last edited by
                  #8

                  toxcct wrote:

                  what about Posting Crap Gang, which is very influent thoses days ?

                  I think you're right. There's a real crappy gang set out these days who don't follow the rules.


                  Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

                  1 Reply Last reply
                  0
                  • T toxcct

                    ThatsAlok wrote:

                    What about Posting Police Gang

                    :~ so you think advising people to follow CP rules is that bad ? what about Posting Crap Gang, which is very influent thoses days ? :suss:


                    Don't know where to start ?
                    Refer the Forums Guidelines and ask a friend

                    [VisualCalc 3.0][Flags Beginner's Guide]

                    T Offline
                    T Offline
                    ThatsAlok
                    wrote on last edited by
                    #9

                    toxcct wrote:

                    :~ so you think advising people to follow CP rules is that bad ?

                    i am not teasing you buddy... just want to from Posting Police Gang(Group).. what you say?

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                    cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

                    T 1 Reply Last reply
                    0
                    • T ThatsAlok

                      toxcct wrote:

                      :~ so you think advising people to follow CP rules is that bad ?

                      i am not teasing you buddy... just want to from Posting Police Gang(Group).. what you say?

                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                      cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

                      T Offline
                      T Offline
                      toxcct
                      wrote on last edited by
                      #10

                      ThatsAlok wrote:

                      what you say?

                      i don't get you... :rolleyes:


                      Don't know where to start ?
                      Refer the Forums Guidelines and ask a friend

                      [VisualCalc 3.0][Flags Beginner's Guide]

                      1 Reply Last reply
                      0
                      • T toxcct

                        ThatsAlok wrote:

                        What about Posting Police Gang

                        :~ so you think advising people to follow CP rules is that bad ? what about Posting Crap Gang, which is very influent thoses days ? :suss:


                        Don't know where to start ?
                        Refer the Forums Guidelines and ask a friend

                        [VisualCalc 3.0][Flags Beginner's Guide]

                        E Offline
                        E Offline
                        Eytukan
                        wrote on last edited by
                        #11

                        I think you misunderstood him !


                        :Gong: 歡迎光臨 吐 西批 :Gong:

                        T 1 Reply Last reply
                        0
                        • T toxcct

                          hey, that's not funny ! we have posting guidelines[^], but nobody respect them :doh:


                          Don't know where to start ?
                          Refer the Forums Guidelines and ask a friend

                          [VisualCalc 3.0][Flags Beginner's Guide]

                          K Offline
                          K Offline
                          kakan
                          wrote on last edited by
                          #12

                          I think the main reason for this behaviour is this (in general): The obvious choice (without reading the guide lines) is to surround source code with the code tags. Which is wrong(!) :sigh: It's not easy (still, for someone who hasn't read the posting guide lines) to realize that the correct choice is to use the pre tags. The name isn't very descriptive... IMO, a change in the names in the formatting options should make it easier for the posters to do the correct choice.

                          Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

                          T 1 Reply Last reply
                          0
                          • K kakan

                            I think the main reason for this behaviour is this (in general): The obvious choice (without reading the guide lines) is to surround source code with the code tags. Which is wrong(!) :sigh: It's not easy (still, for someone who hasn't read the posting guide lines) to realize that the correct choice is to use the pre tags. The name isn't very descriptive... IMO, a change in the names in the formatting options should make it easier for the posters to do the correct choice.

                            Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

                            T Offline
                            T Offline
                            toxcct
                            wrote on last edited by
                            #13

                            kakan wrote:

                            IMO, a change in the names in the formatting options should make it easier for the posters to do the correct choice

                            i think this will need a big big change in the CP engine. a better/simpler solution would be to provide a more explicit picture on the buttons which allow to surround a text with one or other html tags...


                            Don't know where to start ?
                            Refer the Forums Guidelines and ask a friend

                            [VisualCalc 3.0][Flags Beginner's Guide]

                            K 1 Reply Last reply
                            0
                            • E Eytukan

                              I think you misunderstood him !


                              :Gong: 歡迎光臨 吐 西批 :Gong:

                              T Offline
                              T Offline
                              toxcct
                              wrote on last edited by
                              #14

                              i think so, because i know Alok is a good guy, wanting the best for CP, but still i can't get what he meant :doh:


                              Don't know where to start ?
                              Refer the Forums Guidelines and ask a friend

                              [VisualCalc 3.0][Flags Beginner's Guide]

                              1 Reply Last reply
                              0
                              • T toxcct

                                kakan wrote:

                                IMO, a change in the names in the formatting options should make it easier for the posters to do the correct choice

                                i think this will need a big big change in the CP engine. a better/simpler solution would be to provide a more explicit picture on the buttons which allow to surround a text with one or other html tags...


                                Don't know where to start ?
                                Refer the Forums Guidelines and ask a friend

                                [VisualCalc 3.0][Flags Beginner's Guide]

                                K Offline
                                K Offline
                                kakan
                                wrote on last edited by
                                #15

                                I'm sure it would help up the situation. Any difference from today must be an improvement... :)

                                Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups