Click here to Skip to main content
15,895,142 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: troubles in making a filecopy program in visual c++ Pin
David Crow13-Jul-05 3:18
David Crow13-Jul-05 3:18 
GeneralRe: troubles in making a filecopy program in visual c++ Pin
Joe Woodbury13-Jul-05 8:10
professionalJoe Woodbury13-Jul-05 8:10 
GeneralRe: troubles in making a filecopy program in visual c++ Pin
firebolt7713-Jul-05 16:27
firebolt7713-Jul-05 16:27 
GeneralRe: troubles in making a filecopy program in visual c++ Pin
Joe Woodbury13-Jul-05 17:44
professionalJoe Woodbury13-Jul-05 17:44 
GeneralRe: troubles in making a filecopy program in visual c++ Pin
firebolt7714-Jul-05 0:21
firebolt7714-Jul-05 0:21 
QuestionDatabase existense in SQL Server ? Pin
Babarsaeed12-Jul-05 19:11
Babarsaeed12-Jul-05 19:11 
AnswerRe: Database existense in SQL Server ? Pin
Christian Graus12-Jul-05 19:51
protectorChristian Graus12-Jul-05 19:51 
AnswerRe: Database existense in SQL Server ? Pin
basementman13-Jul-05 5:00
basementman13-Jul-05 5:00 
Q1: This example (not tested) is how you could write a function to determine whether a database exists (using our internal ODBC wrapper classes).

BOOL DoesDatabaseExist(char *cpDBName, char *cpDSN, char *cpUserID, char *cpPassword)
{
  BOOL bDBExists = FALSE;

  DBConnection oDBConn;
  if (oDBConn.Connect(cpDSN,cpUserID,cpPassword))
    {
      char caBuf[256];
 
      sprintf(caBuf,"select COUNT(*) from master..sysdatabases where name = '%s'",cpDBName);
      DBStatement *pStmt = oDBConn.ExecSQL(caBuf);
      if (pStmt)
        {
          if (pStmt->FetchNext())
            bDBExists = pStmt->GetShort(1);

          pStmt->EndSQL();
          delete pStmt;
        }
      else
        DoDBError("Select Error",&oDBConn);

      oDBConn.Disconnect();
    }
  else
    DoDBError("Connection Failed!",&oDBConn);

  return bDBExists;
}


Q2: Using the same form as above, you would execute the CREATE DATABASE command instead of a select. Note that the CREATE DATABASE command does not return any result sets. For more info, see CREATE DATABASE in SQL BOL.


Q3: Post to C# forum... I do C but I am not sharp Poke tongue | ;-P


 onwards and upwards... 
Generalstatic global variables problem Pin
VV114412-Jul-05 19:07
VV114412-Jul-05 19:07 
GeneralRe: static global variables problem Pin
Christian Graus12-Jul-05 19:47
protectorChristian Graus12-Jul-05 19:47 
GeneralRe: static global variables problem Pin
Bob Stanneveld12-Jul-05 21:04
Bob Stanneveld12-Jul-05 21:04 
GeneralRe: static global variables problem Pin
VV114413-Jul-05 7:06
VV114413-Jul-05 7:06 
GeneralRe: static global variables problem Pin
Bob Stanneveld13-Jul-05 20:28
Bob Stanneveld13-Jul-05 20:28 
GeneralXP-Style menu in win32 Pin
Anonymous12-Jul-05 18:36
Anonymous12-Jul-05 18:36 
GeneralRe: XP-Style menu in win32 Pin
Graham Bradshaw12-Jul-05 22:03
Graham Bradshaw12-Jul-05 22:03 
GeneralVirtualAlloc at specific address Pin
Blake V. Miller12-Jul-05 18:10
Blake V. Miller12-Jul-05 18:10 
GeneralRe: VirtualAlloc at specific address Pin
Toby Opferman12-Jul-05 19:56
Toby Opferman12-Jul-05 19:56 
GeneralRe: VirtualAlloc at specific address Pin
Blake Miller13-Jul-05 8:06
Blake Miller13-Jul-05 8:06 
GeneralTLS in a static library Pin
Chintoo72312-Jul-05 18:06
Chintoo72312-Jul-05 18:06 
GeneralRe: TLS in a static library Pin
Chintoo72312-Jul-05 18:15
Chintoo72312-Jul-05 18:15 
GeneralRe: TLS in a static library Pin
Magnus Westin13-Jul-05 2:32
Magnus Westin13-Jul-05 2:32 
GeneralBitmap in headcontrol does not work fine in Windows XP style Pin
lisoft12-Jul-05 16:26
lisoft12-Jul-05 16:26 
Generaltaskbar problem Pin
da^hype12-Jul-05 15:33
da^hype12-Jul-05 15:33 
GeneralRe: How to Insert a number into the Oracle Pin
Christian Graus12-Jul-05 17:33
protectorChristian Graus12-Jul-05 17:33 
Generalgetting yesterday's date Pin
Camron12-Jul-05 9:50
Camron12-Jul-05 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.