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

C / C++ / MFC

 
GeneralRe: Image/Motion Detection Pin
Richard MacCutchan12-Dec-11 22:57
mveRichard MacCutchan12-Dec-11 22:57 
QuestionFlash Player Activex problem Pin
trioum12-Dec-11 16:57
trioum12-Dec-11 16:57 
AnswerRe: Flash Player Activex problem Pin
KingsGambit12-Dec-11 17:17
KingsGambit12-Dec-11 17:17 
GeneralRe: Flash Player Activex problem Pin
trioum12-Dec-11 18:36
trioum12-Dec-11 18:36 
QuestionODBC - Using Parameters to build a SQL Command Pin
jkirkerx12-Dec-11 5:26
professionaljkirkerx12-Dec-11 5:26 
AnswerRe: ODBC - Got this to work, perhaps 1 thing away Pin
jkirkerx12-Dec-11 6:39
professionaljkirkerx12-Dec-11 6:39 
GeneralRe: ODBC - Got this to work, perhaps 1 thing away Pin
jschell12-Dec-11 8:28
jschell12-Dec-11 8:28 
GeneralRe: ODBC - Got this to work, perhaps 1 thing away Pin
jkirkerx12-Dec-11 9:46
professionaljkirkerx12-Dec-11 9:46 
The original question was no question because I had no clue why it didn't work, so I wasn't really able to ask a precise question.

The 2nd post works, but I wasn't able to use VALUES(@FirstName) and then state

retcode = SQLSetDescField(hIpd, 1, SQL_DESC_NAME, L"@FirstName", SQL_NTS );


So that the data in the SQLBindParameter would hook up or link to the SQL Command @FirstName.

So I just went back to the VALUES(?), and the record writes to the table.

What I meant by skipped is that the statement is there, but is not relevant is any way, because only stored procedures can use the naming convention according to some MSDN documentation that I read.

But who knows, maybe I can get it working if I dig deeper. Right now, I 'm going to finish out the function with the Timestamp and MD5 Hash, and try the parameter again later.
This is my first ODBC Experience in which I'm submitting data to a table, and wanted to get it right before I write 20 more of these by the end of the month.

retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
										
// Build the SQLServer Command Instructions
WCHAR pzSQLCommand[512];
swprintf_s(pzSQLCommand, 512, 
L"INSERT INTO UserInfo(FirstName, LastName, UserName, PhraseHint, Phrase, PasswordClear, Email, DateOpened, FrontAdmin, SecurityLevel, Enabled, LastLogin) "
L"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
pzSQLCommand[wcslen(pzSQLCommand) + 1] = L'\0';	

retcode = SQLPrepare(hstmt, pzSQLCommand, SQL_NTS );																	
					
retcode = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 25, 0, pzFirstName, wcslen(pzFirstName), NULL );
retcode = SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 40, 0, pzLastName, wcslen(pzLastName), NULL );
retcode = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzAccountName, wcslen(pzAccountName), NULL );
retcode = SQLBindParameter(hstmt, 4, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzSecretQuestion, wcslen(pzSecretQuestion), NULL);
retcode = SQLBindParameter(hstmt, 5, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzSecretAnwser, wcslen(pzSecretAnwser), NULL);
retcode = SQLBindParameter(hstmt, 6, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzPassword, wcslen(pzPassword), NULL);
retcode = SQLBindParameter(hstmt, 7, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_VARCHAR, 80, 0, pzEmailAddress, wcslen(pzEmailAddress), NULL);
retcode = SQLBindParameter(hstmt, 8, SQL_PARAM_INPUT, SQL_C_TYPE_TIMESTAMP, SQL_DATETIME, 16, 0, pzDateOpened, 0, NULL);
retcode = SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_BIT, SQL_BIT, 0, 0, &bFrontAdmin, 1, NULL);
retcode = SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &pzSecurityLevel, 1, NULL);
retcode = SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_BIT, SQL_BIT, 0, 0, &bUserEnabled, 1, NULL);
retcode = SQLBindParameter(hstmt, 12, SQL_PARAM_INPUT, SQL_C_TYPE_TIMESTAMP, SQL_DATETIME, 16, 0, pzLastLogin, 16, NULL);
	
retcode = SQLGetStmtAttr(hstmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd, 0, 0);
retcode = SQLSetDescField(hIpd, 1, SQL_DESC_NAME, L"@FirstName", SQL_NTS );
retcode = SQLSetDescField(hIpd, 2, SQL_DESC_NAME, L"@LastName", SQL_NTS );
retcode = SQLSetDescField(hIpd, 3, SQL_DESC_NAME, L"@UserName", SQL_NTS );
retcode = SQLSetDescField(hIpd, 4, SQL_DESC_NAME, L"@PhraseHint", SQL_NTS );
retcode = SQLSetDescField(hIpd, 5, SQL_DESC_NAME, L"@Phrase", SQL_NTS );
retcode = SQLSetDescField(hIpd, 6, SQL_DESC_NAME, L"@PasswordClear", SQL_NTS );
retcode = SQLSetDescField(hIpd, 7, SQL_DESC_NAME, L"@Email", SQL_NTS);
retcode = SQLSetDescField(hIpd, 8, SQL_DESC_NAME, L"@DateOpened", SQL_NTS);
retcode = SQLSetDescField(hIpd, 9, SQL_DESC_NAME, L"@FrontAdmin", SQL_NTS);
retcode = SQLSetDescField(hIpd, 10, SQL_DESC_NAME, L"@SecurityLevel", SQL_NTS);
retcode = SQLSetDescField(hIpd, 11, SQL_DESC_NAME, L"@Enabled", SQL_NTS);
retcode = SQLSetDescField(hIpd, 12, SQL_DESC_NAME, L"@LastLogin", SQL_NTS);					
																									
// Fire off the SQL Command					
retcode = SQLExecute(hstmt);

GeneralRe: ODBC - Got this to work, perhaps 1 thing away Pin
Bram van Kampen12-Dec-11 15:08
Bram van Kampen12-Dec-11 15:08 
GeneralRe: ODBC - Got this to work, perhaps 1 thing away Pin
jkirkerx12-Dec-11 16:06
professionaljkirkerx12-Dec-11 16:06 
QuestionHow to play those MOV files those are not played in Window Media Player? Pin
Le@rner11-Dec-11 23:46
Le@rner11-Dec-11 23:46 
AnswerRe: How to play those MOV files those are not played in Window Media Player? Pin
JackDingler12-Dec-11 9:18
JackDingler12-Dec-11 9:18 
GeneralRe: How to play those MOV files those are not played in Window Media Player? Pin
Le@rner12-Dec-11 17:26
Le@rner12-Dec-11 17:26 
GeneralRe: How to play those MOV files those are not played in Window Media Player? Pin
JackDingler12-Dec-11 20:58
JackDingler12-Dec-11 20:58 
AnswerRe: How to play those MOV files those are not played in Window Media Player? Pin
User 742933812-Dec-11 9:18
professionalUser 742933812-Dec-11 9:18 
QuestionCProgressCtrl- Marquee Mode Pin
Bram van Kampen11-Dec-11 15:04
Bram van Kampen11-Dec-11 15:04 
AnswerRe: CProgressCtrl- Marquee Mode Pin
Richard MacCutchan11-Dec-11 22:38
mveRichard MacCutchan11-Dec-11 22:38 
GeneralRe: CProgressCtrl- Marquee Mode Pin
Bram van Kampen12-Dec-11 14:30
Bram van Kampen12-Dec-11 14:30 
GeneralRe: CProgressCtrl- Marquee Mode Pin
Richard MacCutchan12-Dec-11 22:39
mveRichard MacCutchan12-Dec-11 22:39 
GeneralRe: CProgressCtrl- Marquee Mode Pin
Bram van Kampen17-Dec-11 16:07
Bram van Kampen17-Dec-11 16:07 
GeneralRe: CProgressCtrl- Marquee Mode Pin
Richard MacCutchan17-Dec-11 21:34
mveRichard MacCutchan17-Dec-11 21:34 
AnswerRe: CProgressCtrl- Marquee Mode Pin
Satheesh154612-Dec-11 1:17
Satheesh154612-Dec-11 1:17 
GeneralRe: CProgressCtrl- Marquee Mode Pin
Bram van Kampen12-Dec-11 14:43
Bram van Kampen12-Dec-11 14:43 
Questionc++ win32 , equivilent to DateTime.Now() in asp.net Pin
jkirkerx11-Dec-11 10:37
professionaljkirkerx11-Dec-11 10:37 
AnswerRe: c++ win32 , equivilent to DateTime.Now() in asp.net Pin
Chandrasekharan P11-Dec-11 20:53
Chandrasekharan P11-Dec-11 20:53 

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.