This question is part of a series of errors in the Microsoft ODBC Driver:
Microsoft said it would not fix these errors in the ODBC driver.
Background
If I have a sample table:
CREATE TABLE Wallet (
WalletID int NOT NULL,
Name varchar(50) NOT NULL
)
I am trying to release sql that inserts into a table without specifying the value of the NOT NULL column of WalletID:
INSERT INTO Wallet (WalletID, Name) VALUES (1, 'Fan')
INSERT INTO Wallet (Name) VALUES ('Ardent Defender')
SQL Server gives an error message:
( 1 ())
Msg 515, 16, 2, 2
NULL "WalletID", "Scratch.dbo.Wallet"; . INSERT .
.
.
ADO/OLEDB OLE DB SQL Server (SQLOLEDB):
Provider = SQLOLEDB; = hyperion; = Contoso; = Trub4dor;
INSERT, ADO/OLEDB/COM , :
NULL "WalletID", ""; . INSERT
.
ODBC
OLE DB ( MS , ODBC ) , SQL Server ODBC:
Provider = MSDASQL; Driver = {SQL Server}; Server = {hyperion}; UID = {Contoso}; PWD = {Trub4dor};
- . Microsoft OLE DB SQL Server OLE DB SQL Server: msoledbsql. ()
Microsoft Microsoft OLE DB SQL Server, SQL Server (SNAC). , Windows, Azure SQL Database JDBC ODBC . , , , SQL Server - OLE DB, .
With this in mind, we decided to remove OLE DB and publish a new version in the first quarter of the calendar year 2018 March 2018.
I release my batch:
INSERT INTO Wallet (WalletID, Name) VALUES (1, 'Fan')
INSERT INTO Wallet (Name) VALUES ('Ardent Defender')
I was surprised to learn the same SQL statement:
When using the ODBC driverwill be no problem . The statement is executed without any error.
I was confused for about an hour when my SQL statements were executed without errors, but the rows did not appear in the database.
Silent failure
Obviously, silent failure is not good.
?
ADO-OLEDB-ODBC . ODBC? MSDASQL?
Psuedocode
Delphi ADO. - # .
String commandText =
"INSERT INTO Wallet (WalletID, Name) VALUES (1, 'Fan')"+CRLF+
"INSERT INTO Wallet (Name) VALUES ('Ardent Defender')";
ADOConnection conn = new ADOConnection();
conn.ConnectionString = szConnectionString;
conn.Open();
HRESULT hr = conn.Execute(commandText, ref recordsAffected, [eoExecuteNoRecords]);
HRESULT - , FAILED.