Try this: #define _WIN32_WINNT 0x0500
-- karl
karl_w
Posts
-
Encryption -
fetching backwardYou could call
SELECT COUNT(*) FROM items
first and then your actual query. -- karl -
Physics query?You mean "The Uncertainty Principle" of Heisenberg? -- karl
-
the real challenge when installing the OSWe take names out of greek mythology: Intranet Web- and Mailserver: HERMES Firewall: KERBEROS Fileserver: ALEXANDRIA (I know it's not out of mythology, but it has a library) Desktops: names connected somehow to the user (our secretary's machine is named APHRODITE, boss' machine ZEUS, his wife's HERA, and so on ...) Domain: HELLAS We also have a little server for LAN-Games (after work!!) It's called DIONYSOS -- karl
-
Select statementThis solution is for Oracle, I don't know if and how you can use it in other systems:
SELECT rownum, col1, col2, col3 FROM table;
-- karl -
Capturing 'Enter' keyJust add a new function called OnOK() in your dialog-class. And be sure not to call CDialog::OnOK() -- karl
-
foreign keyylaine wrote: tblcompany - accountnumber (primary key) : varchar - companyname : varchar - address : varchar tblcustomer - customerid (primary key, auto generated) : int - companyname [foreign key] : varchar - username : varchar - password : varchar - name : varchar - contactnumber : int The foreign key in tblcustomer references to the PRIMARY KEY of tblcompany. So it references to accountnumber and not to companyname. If you want to set a foreign key to companyname you must define it as UNIQUE in tblcompany and change the fk-constraint to point to companyname. -- karl
-
foreign keyFirst of all: 1. What DB do you use? Oracle, SQL-Server, Access, DB2? 2. Post your error message (or error code) 3. Post your table-definitons 4. Post the INSERTs you tried. Some things you should check: 1. Most DBs are case sensitive. So 'comp1' != 'Comp1' => master-key won't be found 2. Even if it sounds silly -> Check for typing errors! 3. Be sure to create a company before creating a customer for it. 4. You can only delete a record from tblcompany if no record of tblcustomer is referencing to it. The included example should work (assuming accountnumber, customerid and contactnumber to be NUMBERS, the others VARCHAR)
INSERT INTO tblcompany VALUES(1, 'comp1', 'someaddress'); INSERT INTO tblcompany VALUES(2, 'comp2', 'someaddress'); INSERT INTO tblcustomer (companyname, username, password, name, contactnumber) VALUES ('comp1', 'uname', '***', 'name', 1);
-- karl -
Syntax error with CREATE TABLEFor SQL-Server the maximum length for TEXT is 2,147,483,647 (and even VARCHAR can store up to 8000 characters), so I don't think 600 should be the problem. Maybe it's just the missing comma again? --edit-- BTW: For 600 characters you shouldn't use TEXT but VARCHAR because of better performance. TEXT is designed for storing large textfiles, so in the table there is only stored a pointer to the actual data. --edit-- -- karl
-
MainFrame OnClose() crashesns wrote: I thought CMDIFrameWnd::OnClose(); would terminate the app.. No, it just closes the window. If you don't want to execute the rest of your code add a
return;
afterCMDIFrameWnd::OnClose();
-- karl -
Modularity with C++ on Windows and LinuxI think he means wxWindows www.wxwindows.org[^] -- karl
-
#iclude problemsmehere wrote: Error E2209 Yahtzmain.cpp 12: Unable to open include file 'Yahzt.h' I know it sounds silly, but are you sure your file is named 'Yahzt.h'? I once mistyped the filename for a class. I wanted to include the headerfile but it wasn't found. After half an hour searching for the error I checked filenames and found the problem :-O -- karl
-
Question about delete a char* pointerYou don't need to release the memory of these variables because they aren't allocated on heap but on stack. Defining
char* q ="54321";
is the same as definingchar q[6] = "54321";
. You only need to use delete/delete [] for variables created with new/new []. -- karl -
Query From Column NameI'm not sure if I understood you right. Maybe you mean how to get the columnnames in you table. Try
DESCRIBE tablename
-- karl -
What is the difference between delete[] and delete?CString *example1; CString *example2; example1 = new CString; //allocate one CString delete example1; example2 = new CString[10]; //allocate an array of 10 CStrings delete [] example2;
Simply said:delete
is for deleting single objects,delete[]
is for deleting arrays of objects. Everything you allocated withnew[]
you should must free withdelete[]
. -- karl -
What is wrong with these SQL statements??Could you post your table-definition? What database are you using? Maybe you have to use
\'
instead of'
? A full SQL-Specification can be found here: http://developer.mimer.com/documentation/Mimer_SQL_Reference_Manual/Mimer_SQL_ReferenceTOC.html[^] -- karl -
What is wrong with these SQL statements??You don't need the "*" but you'll need "from" so the right statement will be (at least in SQL92)
DELETE FROM branches WHERE branch_no LIKE '4%'
-- karl -
Need help in using CryptoAPIvuduo wrote: In order compile my application, do I have to add any macro in my code or download any service pack for my Visual Studio? Try this one:
#define _WIN32_WINNT 0x0500
This should do the trick. -- karl -
Intefacing a database with ANSI C++If you know what DB you will use and you know it won't change, you can use the API of your DB. I think most of the known DBs have at least a C Interface you can use. For Oracle look for OCI (Oracle Call Interface) in the Oracle-Docs (online at otn.oracle.com[^] ) <--edit--> Forgot to mention Pro*C/C++ Precompiler for Oracle. With this precompiler you can write your SQL-Statemetns simply into your C/C++ code. Then run the precompiler. It will subsitute your statements with the correct OCI-calls. <--edit--> If you don't know what DB you will use or you want to be able to change it very easy you can use ODBC. The hardest way: You can implement a generic Data-Access-Class in combination with a Wrapper-Class for each DB-API. So you just replace your wrapper class and you can use another DB. :-D -- karl
-
Does anyone have any tutorials on using SQL with C++..You know, this is quite the hardest way to interact with a database? For using the API there are many good examples in the MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/dasdkodbcoverview.asp[^] For SQL-Beginners this site could be helpful (I didn't have a deep look into it, just read the titles): http://www.w3schools.com/sql/default.asp[^] Hint: Search for SQL + tutorial on google. There are many other sites. -- karl