Open chriltola opened 1 year ago
i have a follow as below in excel fomular:
=IF(COUNTA(C4:C9)>0, 1, 0) + IF(COUNTA(D4:D9)>0, 1, 0) +IF(COUNTA(C11:C16)>0, 1, 0) + IF(COUNTA(D11:D16)>0, 1, 0) +IF(COUNTA(C18:C23)>0, 1, 0) + IF(COUNTA(D18:D23)>0, 1, 0) +IF(COUNTA(C25:C30)>0, 1, 0) + IF(COUNTA(D25:D30)>0, 1, 0) ...................................................
+IF(COUNTA(C214:C219)>0, 1, 0) + IF(COUNTA(D214:D219)>0, 1, 0) please make it till C214
write a term condition for who lose the DIGIPASS GO v6 hardware token devices will penalty for full prize and provide the reason ot Head of Department.
"Any loss of the DIGIPASS GO v6 hardware token device will result in the individual being accountable for the full replacement cost of the device. The employee must furnish a justification for the loss to the Head of Department, who will evaluate the reason and determine whether to approve the replacement cost."
"In the event of a lost DIGIPASS GO v6 hardware token device, a penalty of $58.3 will apply for device replacement. An explanation of the loss must be submitted to the Head of Department for evaluation and approval."
Dear Support Team,
I have change new password of data upload user but unfortunately user B2B_CPB cannot login after changing password.
Please kindly check.
Regards, Tola Chril
Subject: Issue with Login for B2B_CPB User Account
Dear Support Team,
I trust this email finds you well. I am writing to bring to your attention an issue that has arisen following a recent password update for the data upload user. Unfortunately, after the password change, the user "B2B_CPB" is encountering difficulties logging into their account.
I kindly request your assistance in investigating and resolving this matter promptly. Your expertise in diagnosing and rectifying technical issues would be greatly appreciated.
Thank you for your prompt attention to this concern. Please keep me updated on the progress of the resolution.
Best regards, Tola Chril
the error is Msg 207, Level 16, State 1, Line 40 Invalid column name 'AMT'. Msg 207, Level 16, State 1, Line 41 Invalid column name 'AMT'. Please note: for the ATM_ is column from tbltrxn with data type VARCHAR(MAX). to compare with @amount pls convert it to interger as @amount.
I apologize for the misunderstanding. If the AMT_
column is of data type VARCHAR(MAX)
in the tbltrxn
table, and you want to compare it with an integer value (@amount
), you'll need to cast the AMT_
column to an appropriate numeric type in the dynamic SQL query. Here's how you can modify your code:
DECLARE @Sql NVARCHAR(MAX);
SET @Sql = N'
INSERT INTO temp (TXDATE, BUSDATE, DORC, TXNUM, TLTXCD, ACCTNO, CUSTID, CCYCD, ShortCD, AMT, ACC_BRID, ACTYPE, WSNAME, TXDESC, CIF_BRID, AMT_, PCT_ID, PCT, PPT, PCTTYPE)
SELECT TXDATE, BUSDATE, DORC, TXNUM, TLTXCD, ACCTNO, CUSTID, CCYCD, ShortCD, AMT, ACC_BRID, ACTYPE, WSNAME, TXDESC, CIF_BRID, AMT_, PCT_ID, PCT, PPT, PCTTYPE
FROM tbltrxn
WHERE SUBSTRING(TXNUM, 1, 3) IN (' + @Branch + ')
AND CAST(REPLACE(AMT, ''[^0-9.]'', '''') AS DECIMAL(18, 2)) > CAST((SELECT REPLACE(amount, ''[^0-9.]'', '''') FROM tblevent WHERE event_id = ' + CAST(@event_id AS NVARCHAR(10)) +') AS DECIMAL(18, 2))
AND WSNAME IN (' + @Channel + ')
AND LEFT(TXDESC, CHARINDEX('' '', TXDESC, CHARINDEX('' '', TXDESC, CHARINDEX('' '', TXDESC) + 1) + 1)) IN (' + @type + ')
AND CAST(REPLACE(AMT_, ''[^0-9.]'', '''') AS DECIMAL(18, 2)) = CAST(@amount AS DECIMAL(18, 2))
';
PRINT @Sql;
-- Execute the dynamic SQL
EXEC sp_executesql @Sql;
In this code, I added the following line to cast the AMT_
column to a DECIMAL(18, 2)
before comparison:
AND CAST(REPLACE(AMT_, ''[^0-9.]'', '''') AS DECIMAL(18, 2)) = CAST(@amount AS DECIMAL(18, 2))
Please make sure to replace @amount
with the actual variable you're using for the comparison. This should resolve the "Invalid column name 'AMT'" error and allow you to compare the `AMT` column with an integer value.
-- Query tblevent to get branch, event_id, channel, and type DECLARE @eventdata TABLE ( event_id INT, branch VARCHAR(MAX), channel VARCHAR(MAX), type VARCHAR(MAX) );
INSERT INTO @eventdata (event_id, branch, channel, type) SELECT event_id, branch, channel, type FROM tblevent WHERE isActive = 1;
-- Loop through each event and perform actions DECLARE @event_id INT; DECLARE @Branch VARCHAR(100); DECLARE @Channel VARCHAR(100); DECLARE @Type VARCHAR(1000);
DECLARE event_cursor CURSOR FOR SELECT event_id, branch, channel, type FROM @eventdata;
OPEN event_cursor; FETCH NEXT FROM event_cursor INTO @event_id, @Branch, @Channel, @Type;
WHILE @@FETCH_STATUS = 0 BEGIN -- Insert data from tbltrxn into temp based on conditions DECLARE @Sql NVARCHAR(MAX); SET @Sql = N' INSERT INTO temp (TXDATE, BUSDATE, DORC, TXNUM, TLTXCD, ACCTNO, CUSTID, CCYCD, ShortCD, AMT, ACC_BRID, ACTYPE, WSNAME, TXDESC, CIFBRID, AMT, PCT_ID, PCT, PPT, PCTTYPE) SELECT TXDATE, BUSDATE, DORC, TXNUM, TLTXCD, ACCTNO, CUSTID, CCYCD, ShortCD, AMT, ACC_BRID, ACTYPE, WSNAME, TXDESC, CIFBRID, AMT, PCT_ID, PCT, PPT, PCTTYPE FROM tbltrxn WHERE SUBSTRING(TXNUM, 1, 3) IN (' + @Branch + ') AND CAST(REPLACE(AMT, ''[^0-9.]'', '''') AS DECIMAL(18, 2)) > CAST((SELECT REPLACE(amount, ''[^0-9.]'', '''') FROM tblevent WHERE event_id = ' + CAST(@eventid AS NVARCHAR(10)) +') AS DECIMAL(18, 2)) AND WSNAME IN (' + @Channel + ') AND LEFT(TXDESC, CHARINDEX('' '', TXDESC, CHARINDEX('' '', TXDESC, CHARINDEX('' '', TXDESC) + 1) + 1)) IN (' + @Type + ') AND CAST(REPLACE(AMT, ''[^0-9.]'', '''') AS DECIMAL(18, 2)) = CAST(@amount AS DECIMAL(18, 2)) ';
PRINT @Sql;
-- Execute the dynamic SQL
EXEC sp_executesql @Sql;
FETCH NEXT FROM event_cursor INTO @event_id, @Branch, @Channel, @Type;
END;
CLOSE event_cursor; DEALLOCATE event_cursor;
sg 137, Level 15, State 2, Line 9 Must declare the scalar variable "@amount".
-- Query tblevent to get branch, event_id, channel, and type DECLARE @eventdata TABLE ( event_id INT, branch VARCHAR(MAX), channel VARCHAR(MAX), type VARCHAR(MAX) );
INSERT INTO @eventdata (event_id, branch, channel, type) SELECT event_id, branch, channel, type FROM tblevent WHERE isActive = 1;
-- Declare the @amount variable DECLARE @amount DECIMAL(18, 2);
-- Set the value of @amount (replace with your actual value) SET @amount = 1000.00; -- Replace with your value
-- Loop through each event and perform actions DECLARE @event_id INT; DECLARE @Branch VARCHAR(100); DECLARE @Channel VARCHAR(100); DECLARE @Type VARCHAR(1000);
DECLARE event_cursor CURSOR FOR SELECT event_id, branch, channel, type FROM @eventdata;
OPEN event_cursor; FETCH NEXT FROM event_cursor INTO @event_id, @Branch, @Channel, @Type;
WHILE @@FETCH_STATUS =
-- Declare and set the @amount variable DECLARE @amount DECIMAL(18, 2); SET @amount = 100.00; -- Replace this with your actual value
-- Query tblevent to get branch, event_id, channel, and type DECLARE @eventdata TABLE ( event_id INT, branch VARCHAR(MAX), channel VARCHAR(MAX), type VARCHAR(MAX) );
-- ... (rest of the code remains the same)
To use libraries like ODBC or OLE DB for connecting C++ to SQL Server, you'll need to follow these general steps:
Install the Necessary Software:
Include Header Files: Include the necessary header files in your C++ code to use the library functions. For ODBC, you'll typically include <sql.h>
and <sqlext.h>
.
Set Up Connection: Create a connection string that specifies the details of the SQL Server instance you want to connect to (server name, database name, credentials, etc.).
Establish Connection: Use library functions to establish a connection to the SQL Server database using the connection string.
Execute SQL Queries: Use library functions to send SQL queries to the database and retrieve results. You can execute SELECT, INSERT, UPDATE, DELETE, and other SQL commands.
Handle Errors: Implement error handling to manage connection failures, query errors, and other issues that might arise during database operations.
Close Connection: Properly close the connection to the database when you're done with your operations.
Here's a simple example of using the ODBC library to connect C++ to SQL Server:
#include <iostream>
#include <sql.h>
#include <sqlext.h>
int main() {
SQLHENV env;
SQLHDBC dbc;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
SQLCHAR connStr[] = "DRIVER={SQL Server};SERVER=your_server;DATABASE=your_database;UID=your_username;PWD=your_password;";
SQLRETURN ret = SQLDriverConnect(dbc, NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);
if (SQL_SUCCEEDED(ret)) {
std::cout << "Connected to SQL Server!" << std::endl;
// Now you can execute SQL queries and perform operations
SQLDisconnect(dbc);
} else {
// Handle connection error
SQLCHAR sqlState[6], errorMsg[SQL_MAX_MESSAGE_LENGTH];
SQLINTEGER nativeError;
SQLSMALLINT msgLen;
SQLGetDiagRec(SQL_HANDLE_DBC, dbc, 1, sqlState, &nativeError, errorMsg, sizeof(errorMsg), &msgLen);
std::cerr << "Connection failed. SQLState: " << sqlState << ", Error: " << errorMsg << std::endl;
}
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
return 0;
}
Please note that this is a basic example, and in a real application, you would need to handle errors more thoroughly, securely manage credentials, and structure your code properly for production use.
i run this code
int main() { SQLHENV env; SQLHDBC dbc;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
SQLCHAR connStr[] = "DRIVER={SQL Server};SERVER=HOE-ITDAPPSPT04\SWEDEN;DATABASE=atm;UID=test;PWD=Password1;";
SQLRETURN ret = SQLDriverConnect(dbc, NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);
if (SQL_SUCCEEDED(ret)) {
std::cout << "Connected to SQL Server!" << std::endl;
// Now you can execute SQL queries and perform operations
SQLDisconnect(dbc);
}
else {
// Handle connection error
SQLCHAR sqlState[6], errorMsg[SQL_MAX_MESSAGE_LENGTH];
SQLINTEGER nativeError;
SQLSMALLINT msgLen;
SQLGetDiagRec(SQL_HANDLE_DBC, dbc, 1, sqlState, &nativeError, errorMsg, sizeof(errorMsg), &msgLen);
std::cerr << "Connection failed. SQLState: " << sqlState << ", Error: " << errorMsg << std::endl;
}
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
return 0;
}
and i got this error
Severity Code Description Project File Line Suppression State
Error C3646 'Data1': unknown override specifier ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 289
Error C3646 'Data2': unknown override specifier ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 290
Error C3646 'Data3': unknown override specifier ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 291
Error C3646 'Data4': unknown override specifier ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 292
Error C3646 'dwFlags': unknown override specifier ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2219
Error C2086 'int DWORD': redefinition ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2196
Error C2086 'int VOID': redefinition ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2231
Error C2065 'LPWSTR': undeclared identifier ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2170
Warning C4129 'S': unrecognized character escape sequence ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 13
Error C2664 'SQLRETURN SQLDriverConnectW(SQLHDBC,SQLHWND,SQLWCHAR ,SQLSMALLINT,SQLWCHAR ,SQLSMALLINT,SQLSMALLINT ,SQLUSMALLINT)': cannot convert argument 3 from 'SQLCHAR [86]' to 'SQLWCHAR ' ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 15
Error C2664 'SQLRETURN SQLGetDiagRecW(SQLSMALLINT,SQLHANDLE,SQLSMALLINT,SQLWCHAR ,SQLINTEGER ,SQLWCHAR ,SQLSMALLINT,SQLSMALLINT )': cannot convert argument 4 from 'SQLCHAR [6]' to 'SQLWCHAR ' ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 29
Error C2378 'SQLULEN': redefinition; symbol cannot be overloaded with a typedef ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 297
Error (active) E0167 argument of type "SQLCHAR " is incompatible with parameter of type "SQLWCHAR " ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 15
Error (active) E0167 argument of type "SQLCHAR " is incompatible with parameter of type "SQLWCHAR " ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 29
Error (active) E0167 argument of type "SQLCHAR " is incompatible with parameter of type "SQLWCHAR *" ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 29
Error (active) E0020 identifier "BOOL" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2195
Error (active) E0020 identifier "DWORD" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2172
Error (active) E0020 identifier "DWORD" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2177
Error (active) E0020 identifier "DWORD" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2185
Error (active) E0020 identifier "DWORD" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2195
Error (active) E0020 identifier "DWORD" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2196
Error (active) E0020 identifier "INT64" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 64
Error (active) E0020 identifier "LPWSTR" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2170
Error (active) E0020 identifier "LPWSTR" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2171
Error (active) E0020 identifier "UINT64" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 65
Error (active) E0020 identifier "UINT64" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 66
Error (active) E0020 identifier "VOID" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2176
Error (active) E0020 identifier "VOID" is undefined ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2231
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 64
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 65
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 289
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 290
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 291
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 297
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2176
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2177
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2195
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2196
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2218
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2219
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2221
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2222
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2225
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2226
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2231
Message see declaration of 'DWORD' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2177
Message see declaration of 'SQLDriverConnectW' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 333
Message see declaration of 'SQLGetDiagRecW' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 210
Message see declaration of 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 65
Message see declaration of 'VOID' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2176
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 621
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 645
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 715
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 750
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 763
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 826
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 829
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 855
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 1930
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 1962
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2160
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 55
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 82
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 188
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 480
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 505
Error C2061 syntax error: identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 597
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 627
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 686
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 839
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 868
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sql.h 880
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 1953
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2009
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2091
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 107
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 277
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 530
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 696
Error C2061 syntax error: identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlucode.h 701
Error C2146 syntax error: missing ')' before identifier 'szFileName' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2170
Error C2143 syntax error: missing ',' before '[' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 292
Error C2143 syntax error: missing ';' before '' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2218
Error C2143 syntax error: missing ';' before '' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2221
Error C2143 syntax error: missing ';' before '' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2222
Error C2143 syntax error: missing ';' before '' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2225
Error C2143 syntax error: missing ';' before '' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2226
Error C2146 syntax error: missing ';' before identifier 'BOOKMARK' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 297
Error C2146 syntax error: missing ';' before identifier 'FireVSDebugEvent' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2231
Error C2146 syntax error: missing ';' before identifier 'ODBCGetTryWaitValue' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2196
Error C2146 syntax error: missing ';' before identifier 'ODBCSetTryWaitValue' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2195
Error C2146 syntax error: missing ';' before identifier 'SQLLEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 64
Error C2146 syntax error: missing ';' before identifier 'SQLULEN' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 65
Error C2146 syntax error: missing ';' before identifier 'TraceReturn' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2176
Error C2146 syntax error: missing ';' before identifier 'TraceVersion' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2177
Message Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 15
Message Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 29
Error C2238 unexpected token(s) preceding ';' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqltypes.h 292
Error C2238 unexpected token(s) preceding ';' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2218
Error C2238 unexpected token(s) preceding ';' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2221
Error C2238 unexpected token(s) preceding ';' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2222
Error C2238 unexpected token(s) preceding ';' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2225
Error C2238 unexpected token(s) preceding ';' ATM C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\sqlext.h 2226
Message while trying to match the argument list '(int, SQLHDBC, int, SQLCHAR [6], SQLINTEGER , SQLCHAR [512], size_t, SQLSMALLINT *)' ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 29
Message while trying to match the argument list '(SQLHDBC, int, SQLCHAR [86], int, int, int, int, int)' ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 15
int main() { SQLHENV env; SQLHDBC dbc;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
// Note the use of L prefix for wide character strings
SQLWCHAR connStr[] = L"DRIVER={SQL Server};SERVER=HOE-ITDAPPSPT04\\SWEDEN;DATABASE=atm;UID=test;PWD=Password1;";
SQLRETURN ret = SQLDriverConnectW(dbc, NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);
if (SQL_SUCCEEDED(ret)) {
std::wcout << L"Connected to SQL Server!" << std::endl;
// Now you can execute SQL queries and perform operations
SQLDisconnect(dbc);
} else {
SQLWCHAR sqlState[6], errorMsg[SQL_MAX_MESSAGE_LENGTH];
SQLINTEGER nativeError;
SQLSMALLINT msgLen;
SQLGetDiagRecW(SQL_HANDLE_DBC, dbc, 1, sqlState, &nativeError, errorMsg, sizeof(errorMsg), &msgLen);
std::wcerr << L"Connection failed. SQLState: " << sqlState << L", Error: " << errorMsg << std::endl;
}
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
return 0;
}
Severity Code Description Project File Line Suppression State Warning C6386 Buffer overrun while writing to 'errorMsg'. ATM C:\Users\PVisal\source\repos\ATM\ATM\ATM.cpp 30
int main() { SQLHENV env; SQLHDBC dbc;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
SQLWCHAR connStr[] = L"DRIVER={SQL Server};SERVER=HOE-ITDAPPSPT04\\SWEDEN;DATABASE=atm;UID=test;PWD=Password1;";
SQLRETURN ret = SQLDriverConnectW(dbc, NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);
if (SQL_SUCCEEDED(ret)) {
std::wcout << L"Connected to SQL Server!" << std::endl;
// Now you can execute SQL queries and perform operations
SQLDisconnect(dbc);
} else {
SQLWCHAR sqlState[6], errorMsg[SQL_MAX_MESSAGE_LENGTH];
SQLINTEGER nativeError;
SQLSMALLINT msgLen;
SQLGetDiagRecW(SQL_HANDLE_DBC, dbc, 1, sqlState, &nativeError, errorMsg, SQL_MAX_MESSAGE_LENGTH, &msgLen);
std::wcerr << L"Connection failed. SQLState: " << sqlState << L", Error: " << errorMsg << std::endl;
}
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
return 0;
}
i want to make testing insert data in to table ATM have column as below: id int Checked Name varchar(MAX) Checked Date datetime Checked Time varchar(MAX) Checked Card_PIN varchar(MAX) Checked AppSelect varchar(MAX) Checked NoteDi varchar(MAX) Checked Crypto varchar(MAX) Checked Card_Note varchar(MAX) Checked Note_Present varchar(MAX) Checked
int main() { SQLHENV env; SQLHDBC dbc; SQLHSTMT stmt;
// Initialize the ODBC environment and establish a connection
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
SQLWCHAR connStr[] = L"DRIVER={SQL Server};SERVER=HOE-ITDAPPSPT04\\SWEDEN;DATABASE=atm;UID=test;PWD=Password1;";
SQLRETURN ret = SQLDriverConnectW(dbc, NULL, connStr, SQL_NTS, NULL, 0, NULL, SQL_DRIVER_COMPLETE);
if (!SQL_SUCCEEDED(ret)) {
SQLWCHAR sqlState[6], errorMsg[SQL_MAX_MESSAGE_LENGTH];
SQLINTEGER nativeError;
SQLSMALLINT msgLen;
SQLGetDiagRecW(SQL_HANDLE_DBC, dbc, 1, sqlState, &nativeError, errorMsg, SQL_MAX_MESSAGE_LENGTH, &msgLen);
std::wcerr << L"Connection failed. SQLState: " << sqlState << L", Error: " << errorMsg << std::endl;
return 1; // Exit with an error code
}
// Prepare an SQL INSERT statement
SQLWCHAR insertStmt[] = L"INSERT INTO ATM (id, Name, Date, Time, Card_PIN, AppSelect, NoteDi, Crypto, Card_Note, Note_Present) "
L"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
ret = SQLAllocHandle(SQL_HANDLE_STMT, dbc, &stmt);
if (!SQL_SUCCEEDED(ret)) {
std::wcerr << L"Failed to allocate statement handle." << std::endl;
SQLDisconnect(dbc);
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
return 1; // Exit with an error code
}
// Bind parameters for the INSERT statement
SQLINTEGER id = 1; // Replace with the actual value
SQLWCHAR name[] = L"John Doe"; // Replace with the actual name
SQL_TIMESTAMP_STRUCT date = {2023, 9, 1, 0, 0, 0, 0}; // Replace with the actual date
SQLWCHAR time[] = L"12:00 PM"; // Replace with the actual time
SQLWCHAR cardPin[] = L"1234"; // Replace with the actual card PIN
SQLWCHAR appSelect[] = L"App1"; // Replace with the actual app select
SQLWCHAR noteDi[] = L"Note1"; // Replace with the actual note
SQLWCHAR crypto[] = L"Crypto1"; // Replace with the actual crypto
SQLWCHAR cardNote[] = L"CardNote1"; // Replace with the actual card note
SQLWCHAR notePresent[] = L"NotePresent1"; // Replace with the actual note present
SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &id, 0, NULL);
SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 0, 0, name, 0, NULL);
SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_TYPE_TIMESTAMP, SQL_TYPE_TIMESTAMP, 0, 0, &date, 0, NULL);
SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 0, 0, time, 0, NULL);
SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 0, 0, cardPin, 0, NULL);
SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 0, 0, appSelect, 0, NULL);
SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 0, 0, noteDi, 0, NULL);
SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 0, 0, crypto, 0, NULL);
SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 0, 0, cardNote, 0, NULL);
SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_WCHAR, SQL_WVARCHAR, 0, 0, notePresent, 0, NULL);
ret = SQLExecDirectW(stmt, insertStmt, SQL_NTS);
if (SQL_SUCCEEDED(ret)) {
std::wcout << L"Data inserted successfully!" << std::endl;
} else {
SQLWCHAR sqlState[6], errorMsg[SQL_MAX_MESSAGE_LENGTH];
SQLINTEGER nativeError;
SQLSMALLINT msgLen;
SQLGetDiagRecW(SQL_HANDLE_STMT, stmt, 1, sqlState, &nativeError, errorMsg, SQL_MAX_MESSAGE_LENGTH, &msgLen);
std::wcerr << L"Insert failed. SQLState: " << sqlState << L", Error: " << errorMsg << std::endl;
}
//
// Close and deallocate the statement handle
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
// Disconnect from the database and release handles
SQLDisconnect(dbc);
SQLFreeHandle(SQL_HANDLE_DBC, dbc);
SQLFreeHandle(SQL_HANDLE_ENV, env);
return 0;
}
i have a follow as below in excel fomular:
=IF(COUNTA(C4:C9)>0, 1, 0) + IF(COUNTA(D4:D9)>0, 1, 0) =IF(COUNTA(C11:C16)>0, 1, 0) + IF(COUNTA(D11:D16)>0, 1, 0) =IF(COUNTA(C18:C23)>0, 1, 0) + IF(COUNTA(D18:D23)>0, 1, 0) =IF(COUNTA(C25:C30)>0, 1, 0) + IF(COUNTA(D25:D30)>0, 1, 0) ...................................................
=IF(COUNTA(C214:C219)>0, 1, 0) + IF(COUNTA(D214:D219)>0, 1, 0) please make it till C214