[Mono-bugs] [Bug 74134][Nor] New - SqlDataAdapter.GetUpdateCommand creates incorrect SQL
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 27 Mar 2005 23:29:37 -0500 (EST)
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 will@digitalelite.com.
http://bugzilla.ximian.com/show_bug.cgi?id=74134
--- shadow/74134 2005-03-27 23:29:37.000000000 -0500
+++ shadow/74134.tmp.13065 2005-03-27 23:29:37.000000000 -0500
@@ -0,0 +1,83 @@
+Bug#: 74134
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details: Ubuntu "Hoary" 5.04
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Data.SqlClient
+AssignedTo: rodrigo@novell.com
+ReportedBy: will@digitalelite.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: SqlDataAdapter.GetUpdateCommand creates incorrect SQL
+
+Description of Problem:
+
+When SqlDataAdapter.GetUpdateCommand is executed the update command
+generated returns the following error:
+
+System.Data.SqlClient.SqlException: Must declare the variable
+'@vchPageCodeSET'.
+
+This seems to indicate that the code generating the SQL command is not
+inserting a space between the variable and the SQL SET directive.
+
+Code to reproduce the problem:
+
+string strSQL = "SELECT * FROM Page WHERE vchPageCode = @vchPageCode";
+daPage = Utility.GetSqlDataAdapter(strSQL,
+ System.Data.SqlDbType.VarChar, 50, "vchPageCode");
+SqlConnection cn = new SqlConnection(strConnectionString);
+SqlDataAdapter da = new SqlDataAdapter(strSQL, cn);
+
+SqlCommandBuilder cb = new SqlCommandBuilder(da);
+da.SelectCommand.Parameters.Add(new
+
+ System.Data.SqlClient.SqlParameter(
+ "@" + sqlParam, sqlDataType, length, sqlParam));
+da.UpdateCommand = cb.GetUpdateCommand();
+
+Feel free to ask if you need more info. The code in question works fine
+using ASP.NET 1.1 but does not run under Mono. Here is the full error
+returned by XSP:
+
+Description: Error processing request.
+
+Error Message: HTTP 500.
+
+Stack Trace:
+
+System.Data.SqlClient.SqlException: Must declare the variable
+'@vchPageCodeSET'.
+in <0x000b2> System.Data.SqlClient.SqlConnection:ErrorHandler
+(System.Object sender,
+Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e)
+in (wrapper delegate-invoke)
+System.MulticastDelegate:invoke_void_object_TdsInternalErrorMessageEventArgs
+(object,Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
+in <0x0001d> Mono.Data.Tds.Protocol.Tds:OnTdsErrorMessage
+(Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e)
+in (wrapper remoting-invoke-with-check)
+Mono.Data.Tds.Protocol.Tds:OnTdsErrorMessage
+(Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs)
+in <0x001b2> Mono.Data.Tds.Protocol.Tds:ProcessMessage (TdsPacketSubType
+subType)
+in (wrapper remoting-invoke-with-check)
+Mono.Data.Tds.Protocol.Tds:ProcessMessage
+(Mono.Data.Tds.Protocol.TdsPacketSubType)
+in <0x0011b> Mono.Data.Tds.Protocol.Tds:ProcessSubPacket ()
+in <0x00047> Mono.Data.Tds.Protocol.Tds:NextResult ()
+in <0x00068> System.Data.SqlClient.SqlDataReader:NextResult ()
+in (wrapper remoting-invoke-with-check)
+System.Data.SqlClient.SqlDataReader:NextResult ()
+in <0x000d7> System.Data.SqlClient.SqlDataReader:.ctor
+(System.Data.SqlClient.SqlCommand command)
+in (wrapper remoting-invoke-with-check)
+System.Data.SqlClient.SqlDataReader:.ctor (System.Data.SqlClient.SqlCommand)
+in <0x0006c> System.Data.SqlClient.SqlCommand:ExecuteReader
+(CommandBehavior behavior)