[Mono-bugs] [Bug 75698][Maj] Changed - ExecuteNonQuery always
return the value -1
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Wed Aug 10 13:53:52 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by lovelydavid at hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75698
--- shadow/75698 2005-08-09 10:50:54.000000000 -0400
+++ shadow/75698.tmp.8795 2005-08-10 13:53:52.000000000 -0400
@@ -27,6 +27,53 @@
behavior.
post atleast a sample table data, and the query which did not return
the rows affected. additionally, if possible, a small test code.
Thanks.
+
+------- Additional Comments From lovelydavid at hotmail.com 2005-08-10 13:53 -------
+After these day's study,I find this problem exists in Asp.Net and when
+you are using SQL's StoredProcedure
+My Sample here:
+Test.aspx
+<%@ Page Language="C#" %>
+<%@ Import Namespace="System" %>
+<%@ Import Namespace="System.Data" %>
+<%@ Import Namespace="System.Data.SqlClient" %>
+<script language="C#" runat="server">
+ void Page_Load(object sender,System.EventArgs e){
+ string connString = "server=(local);uid=sa;
+pwd=*****;database=Northwind";
+ int rowsAffected = 0;
+ using(SqlConnection conn = new
+SqlConnection(connString)){
+ conn.Open();
+ SqlCommand command = new
+SqlCommand("procTest",conn);
+ command.CommandType = CommandType.
+StoredProcedure;
+ command.Parameters.Add(new
+SqlParameter("@id",SqlDbType.Int));
+ command.Parameters[0].Value = 1;
+ rowsAffected = command.ExecuteNonQuery(
+);
+ }
+ Response.Write(rowsAffected);
+
+ }
+</script>
+And my stored procedure is:
+CREATE PROCEDURE procTest(@id int)
+AS
+UPDATE Products SET ProductName='Mono' WHERE ProductID=@id
+
+In MS's .Net,it will return the value 1,but in Mono,it always return
+the value -1.
+I test it on Windows2003,and I'm sure it also exists in my Red Hat AS
+3.
+
+But when you define CommandType as CommandType.Text,it runs right and
+ruturn the affected rows
+
+Hope you can solve this problem soom
+:)
More information about the mono-bugs
mailing list