Click here to Skip to main content
15,893,588 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: The amazing vanishing keypress Pin
icabod3-Oct-05 5:55
icabod3-Oct-05 5:55 
GeneralRe: The amazing vanishing keypress Pin
icabod3-Oct-05 6:06
icabod3-Oct-05 6:06 
GeneralRe: The amazing vanishing keypress Pin
hairy_hats3-Oct-05 23:11
hairy_hats3-Oct-05 23:11 
QuestionCRecordSet ? - adding new records Pin
ddmcr3-Oct-05 3:22
ddmcr3-Oct-05 3:22 
AnswerRe: CRecordSet ? - adding new records Pin
vikas amin3-Oct-05 3:54
vikas amin3-Oct-05 3:54 
QuestionRe: CRecordSet ? - adding new records Pin
ddmcr3-Oct-05 4:06
ddmcr3-Oct-05 4:06 
AnswerRe: CRecordSet ? - adding new records Pin
vikas amin3-Oct-05 4:36
vikas amin3-Oct-05 4:36 
QuestionRe: CRecordSet ? - adding new records [modified] Pin
ddmcr3-Oct-05 5:33
ddmcr3-Oct-05 5:33 
I've added next code in TRY block



...
CString name,surname;
name="Jon";
surname="Doe";
int nID=200;
SqlString.Format("INSERT INTO Table1 (ID,Name,Surname) VALUES (%d,%s,%s)",nID,name,surname);

database.ExecuteSQL(SqlString);
...


but i get exception thrown , with message box : "Database error. Too few parameters.Expected 2"

after i modified the code like this :

SqlString = "INSERT INTO Table1 (ID,Name,Surname) VALUES ('200','jon','doe') ";


everything is ok ,do you know whats wrong with the previous codeConfused | :confused:
thanks for helpCool | :cool:

[Fixed]

I found out why exception was thrown.
Instead of :
SqlString.Format(_T("INSERT INTO Recordset_name(ID,Name,Surname) VALUES<br />
(%d,%s,%s)"),i_ID,c_Name,c_surname);

I had to write :
SqlString.Format(_T("INSERT INTO Recordset_name(ID,Name,Surname) VALUES<br />
('%d','%s','%s')"),i_ID,c_Name,c_surname);






"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill



-- modified at 15:50 Monday 3rd October, 2005
AnswerRe: CRecordSet ? - adding new records Pin
hairy_hats3-Oct-05 5:24
hairy_hats3-Oct-05 5:24 
GeneralRe: CRecordSet ? - adding new records Pin
ddmcr3-Oct-05 5:54
ddmcr3-Oct-05 5:54 
AnswerRe: CRecordSet ? - adding new records Pin
Ghasrfakhri3-Oct-05 5:41
Ghasrfakhri3-Oct-05 5:41 
GeneralRe: CRecordSet ? - adding new records Pin
ddmcr3-Oct-05 5:51
ddmcr3-Oct-05 5:51 
AnswerRe: CRecordSet ? - adding new records Pin
Ghasrfakhri3-Oct-05 5:57
Ghasrfakhri3-Oct-05 5:57 
QuestionTransparent drawing Pin
Jagadeesh VN3-Oct-05 2:55
Jagadeesh VN3-Oct-05 2:55 
AnswerRe: Transparent drawing Pin
vikas amin3-Oct-05 3:24
vikas amin3-Oct-05 3:24 
AnswerRe: Transparent drawing Pin
Chris Losinger3-Oct-05 6:28
professionalChris Losinger3-Oct-05 6:28 
AnswerRe: Transparent drawing Pin
Lane Yu3-Oct-05 19:22
Lane Yu3-Oct-05 19:22 
Questionword addin Pin
a0kboy3-Oct-05 2:12
a0kboy3-Oct-05 2:12 
QuestionBitmap dialog Pin
rajeev823-Oct-05 2:04
rajeev823-Oct-05 2:04 
AnswerRe: Bitmap dialog Pin
Mircea Puiu3-Oct-05 2:28
Mircea Puiu3-Oct-05 2:28 
AnswerRe: Bitmap dialog Pin
vikas amin3-Oct-05 2:51
vikas amin3-Oct-05 2:51 
AnswerRe: Bitmap dialog Pin
vikas amin3-Oct-05 3:40
vikas amin3-Oct-05 3:40 
Questionhow many message maps in MFC Pin
Santosh Kumar793-Oct-05 1:52
Santosh Kumar793-Oct-05 1:52 
AnswerRe: how many message maps in MFC Pin
toxcct3-Oct-05 2:01
toxcct3-Oct-05 2:01 
QuestionRe: how many message maps in MFC Pin
David Crow3-Oct-05 2:44
David Crow3-Oct-05 2:44 

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.