0
MySQL과 함께 ADO.NET을 사용하고 있습니다. 그것이 OUT 매개 변수해야 @ID 매개 변수로 행 "ID"열을 채우는 것을ADO.NET에서 행 ID를 검색하는 방법 DataAdapter.InsertCommand
MySqlCommand insertCommand = new MySqlCommand(@"INSERT INTO Investments (InvestmentType)
VALUES (@InvestmentType); SET @[email protected]@IDENTITY;"
, (MySqlConnection)Connection);
insertCommand.Parameters.Add("@InvestmentType", MySqlDbType.VarChar, 255, "InvestmentType");
DbParameter parameter = insertCommand.Parameters.Add("@ID", MySqlDbType.UInt32, 0, "ID");
parameter.Direction = ParameterDirection.Output;
((MySqlDataAdapter)InvestmentsAdapter).InsertCommand = insertCommand;
((MySqlDataAdapter)EmptyInvestmentsAdapter).InsertCommand = insertCommand;
내가 기대하지만에 예외를 제기
데이터를 삽입하기 위해, 나는 데이터 어댑터 (MySqlDataAdapter)를 사용 MySQL은 "SET NULL = @@ IDENTITY;"로 평가되므로 문제가 발생합니다.
아이디어가 있으십니까?
이것은 MySQL을 사용하는 동안 SQL Server를 사용하는 것으로 보이는 팀 쿡의 "Microsoft ADO.NET 4"에서 영감을 얻었습니다. MySQL 어댑터의 출력 매개 변수에 대한 설명서를 찾을 수 없습니다.