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
D

Durga_Devi

@Durga_Devi
About
Posts
15
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Generic Get and Set as interface
    D Durga_Devi

    HI pasztporpist As per your input i have done the code

    // App_Datatype.cpp : Defines the entry point for the console application.
    //
    #include <iostream>
    #include <tchar.h>
    #include <stdio.h>

    class CStringValue;
    class CValue
    {
    public:

    enum EType
    {
        EType\_String,
        EType\_Int,
    };
    
    
    virtual EType getDataType() = 0;
    
    virtual CStringValue\* AsStringValue() { return NULL; }
    

    };

    class CStringValue : public CValue
    {
    private:
    std::string m_strValue;

    public:

    void set(const std::string &strVal)
    {
    	m\_strValue = strVal;
    }
    
    std::string get()
    {
    	return m\_strValue;
    }
    
    CStringValue\* AsStringValue()
    {
    	return this;
    }
    
    EType getDataType()
    {
    	return CValue::EType\_String;
    }
    

    };

    void print(CValue *pVal)
    {
    if(pVal->getDataType() == CValue::EType_String)
    {
    CStringValue *val = pVal->AsStringValue();
    std::cout<<val->get().c_str();
    }
    }

    int _tmain(int argc, _TCHAR* argv[])
    {

    CStringValue \*val = new CStringValue();
    val->set("Hai");
    
    print(val);
    
    return 0;
    

    }

    Is it correct? If not tell me where i did a mistake

    C / C++ / MFC com tutorial

  • Generic Get and Set as interface
    D Durga_Devi

    Hi pasztorpisti, I have one doubt. I can go with the enumerator alone , instead of having the downcast method? Can you please explain me how it has to be in implementation class. Thanks in advance.

    C / C++ / MFC com tutorial

  • Generic Get and Set as interface
    D Durga_Devi

    Thanks pal. Thanks for ur input. I will try using the first method.

    C / C++ / MFC com tutorial

  • Generic Get and Set as interface
    D Durga_Devi

    Hi all, I want to have an interface for setting and getting the different value from/to com dll. The value can be of any datatype, i,e it support int, char, long, short, string. Can any one suggest how to handle this. I know we cant have virtual template function or interface as a template. Any idea is highly appreciated. Thanks in advance. regards, Durga

    C / C++ / MFC com tutorial

  • MSSQL Database get database
    D Durga_Devi

    Cool yaar! What's the mistake have u done? The query for fetching the table name is "select name from sysobjects where type = 'U'". This query will display the table name that is created by user. Before executing this, run the query "use ".

    C / C++ / MFC database sql-server help sysadmin

  • MSSQL Database get database
    D Durga_Devi

    Give me some time. I dont have sql server now to write sample. will send it by tomorrow.

    C / C++ / MFC database sql-server help sysadmin

  • MSSQL Database get database
    D Durga_Devi

    That what i am saying. If u want to query any sys databases. First we have to switch to master user and then only we can fetch the records from the sysdatabases. From the ordinary user u cant execute the query.

    C / C++ / MFC database sql-server help sysadmin

  • MSSQL Database get database
    D Durga_Devi

    Hi, Before executing the query "SELECT * FROM SYS.DATABASES", execute this query "USE master" and try ur select query. I think it will work.

    C / C++ / MFC database sql-server help sysadmin

  • Failed to initialize COM library error
    D Durga_Devi

    HI, For the function CoInitializeEx(), dont check for the returned code. Because if the COM has been initialized on the calling thread, the return code will be failed i.e S_FALSE. Just call the CoInitializeEx() and proceed to next.

    C / C++ / MFC help visual-studio com question

  • DSN Creation through SQLConfigDataSource() funciton
    D Durga_Devi

    Tanx for ur reply!!

    C / C++ / MFC database help question

  • DSN Creation through SQLConfigDataSource() funciton
    D Durga_Devi

    Hi Moak, I tried the logic as specified in the link. It worked fine. Thanks for that. But can u tell me, why SQLConfigDataSource() parameter alone is accepting the null terminator string? Any idea about that? :)

    C / C++ / MFC database help question

  • DSn Creation through SQLConfigDataSource() funciton
    D Durga_Devi

    Hi, The following sample failed to create the DSN, void main() { //As my DB path will change frequently i am using this method. bool aDSNCreated = false; char temp[MAX_PATH]; sprintf(temp,"DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0"); aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "Microsoft Access Driver (*.mdb)\0", temp); printf("%d",aDSNCreated ); } whereas when I execute the below code; it execute successfully.Can anyone help in this why its happening? void main() { bool aDSNCreated = false; aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "Microsoft Access Driver(*.mdb)\0","DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0"); printf("%d",aDSNCreated ); }

    Database database help question

  • DSN Creation through SQLConfigDataSource() funciton
    D Durga_Devi

    Hi, The following sample failed to create the DSN, void main() { //As my DB path will change frequently i am using this method. bool aDSNCreated = false; char temp[MAX_PATH]; sprintf(temp,"DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0"); aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "Microsoft Access Driver (*.mdb)\0", temp); printf("%d",aDSNCreated ); } whereas when I execute the below code; it execute successfully.Can anyone help in this why its happening? void main() { bool aDSNCreated = false; aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "Microsoft Access Driver(*.mdb)\0","DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0"); printf("%d",aDSNCreated ); }

    C / C++ / MFC database help question

  • File access in C++
    D Durga_Devi

    Thanks for all your replies. I tried with "wb" and "rb" mode and its working fine.

    C / C++ / MFC c++ performance help

  • File access in C++
    D Durga_Devi

    Hi, While reading the double value from the written text file, the memory get corrupetd.Here is the sample code and its output for the scenario. Can anyone help in this.

    #include ;
    #include "stdafx.h"

    int main(int argc, char* argv[])
    {
    double dbleArray[][4] = { -315.00000255999998,0.00000000000000000,0.00000000000000000,-166.19238000000001,
    -329.19238000000001,315.00000255999998,-329.19238000000001,-329.19238000000001,
    0.00000000000000000,0.00000000000000000,320.00000000000000,-536.00000000000000,
    0.00000000000000000,0.00000000000000000,0.00000000000000000,1.0000000000000000};

    //Write the data to the file
    FILE\* pFile = NULL;
    pFile = \_wfopen(L"C:\\\\Temp\\\\InputVolumeDetails.txt", L"w");
    if(pFile)
    {
    	for(int nRow=0; nRow<4; nRow++)
    	{
    		for(int nCol=0; nCol<4; nCol++)
    		{
    			fwrite(&dbleArray\[nRow\]\[nCol\], sizeof(double), 1, pFile);
    		}
    	}
    }
    fclose(pFile);
    
    //Read the data from the file
    double dbleArray\_r\[4\]\[4\];
    FILE\* pFile\_r = NULL;
    pFile\_r = \_wfopen(L"C:\\\\Temp\\\\InputVolumeDetails.txt", L"r");
    if(pFile\_r)
    {
    	for(int nRow=0; nRow<4; nRow++)
    	{
    		for(int nCol=0; nCol<4; nCol++)
    		{
    			fread(&dbleArray\_r\[nRow\]\[nCol\], sizeof(double), 1, pFile\_r);
    			printf("%f\\n",dbleArray\_r\[nRow\]\[nCol\]);
    		}
    	}
    }
    fclose(pFile);
    
    return 0;
    

    }

    The output for the above code is -315.000003 0.000000 0.000000 -92559631348757048000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000 -92559631349317831000000000000000000000000000000000000000000000.000000

    C / C++ / MFC c++ performance help
  • Login

  • Don't have an account? Register

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