https://bugzilla.novell.com/show_bug.cgi?id=470579
Summary: SqlCommand.ExecuteNonQuery throws exception when
trying to execute commands that returns values in
output parameter
Classification: Mono
Product: Mono: Class Libraries
Version: 2.2.x
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.Data.SqlClient
AssignedTo: [email protected]
ReportedBy: [email protected]
QAContact: [email protected]
Found By: Community User
Execute the following piece of code:
SqlCommand command = new SqlCommand(@"
INSERT INTO tbl_test
(name, userId, type, lastEditedOn)
VALUES
(@Name, @UserId, @Type, @LastEditedOn)
SET @NewId = @@IDENTITY
");
command.Parameters.Add("@NewId", SqlDbType.Int);
command.Parameters["@NewId"].Direction =
ParameterDirection.Output;
command.Parameters.Add("@UserId",
SqlDbType.UniqueIdentifier).Value =
userId;
command.Parameters.Add("@Name", SqlDbType.NVarChar,
256).Value = name;
command.Parameters.Add("@LastEditedOn",
SqlDbType.DateTime).Value = lastEditedOn;
command.Parameters.Add("@Type", SqlDbType.NVarChar, 256).Value =
type;
SqlDB.ExecuteNonQuery(command);
int newId =
int.Parse(command.Parameters["@NewId"].Value.ToString());
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs