[Mono-bugs] [Bug 82170][Nor] Changed - Large strings truncated with SqlClient

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jul 24 02:08:34 EDT 2007


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 anagappan at novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=82170

--- shadow/82170	2007-07-24 02:07:55.000000000 -0400
+++ shadow/82170.tmp.2466	2007-07-24 02:08:34.000000000 -0400
@@ -1,14 +1,14 @@
 Bug#: 82170
 Product: Mono: Class Libraries
 Version: 1.2
-OS: 
+OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: Sys.Data.SqlClient
 AssignedTo: anagappan at novell.com                            
 ReportedBy: anagappan at novell.com               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
@@ -35,6 +35,55 @@
 
 How often does this happen? 
 Always
 
 Additional Information:
 http://lists.ximian.com/pipermail/mono-list/2007-June/035318.html
+
+------- Additional Comments From anagappan at novell.com  2007-07-24 02:08 -------
+Here is what I have here.
+
+UglyQuickAndDirty code :
+
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+namespace SqlServerTest
+{
+    class MainClass
+    {
+        public static void Main(string[] args)
+        {
+            string longstring = new String('x',20480);
+            SqlConnection sc = new SqlConnection(@"Server=<a server>;
+DataBase=<a db>; User ID=<sql server login>; Password=<sql server
+password>;");
+            SqlCommand cmd;
+            SqlParameter prm;
+            sc.Open();
+                   
+            cmd.CommandText = "INSERT INTO Table1(ID,Val1) VALUES
+(@ID, at Val1)";
+           
+            prm = new SqlParameter();
+            prm.ParameterName = "@ID";
+            prm.Value = 1;
+            cmd.Parameters.Add(prm);
+           
+            prm = new SqlParameter();
+            prm.ParameterName = "@Val1";
+            prm.Value = longstring;
+            prm.SqlDbType = SqlDbType.NText; // Comment and enjoy the
+truncation
+            cmd.Parameters.Add(prm);
+           
+            cmd.ExecuteNonQuery();
+                       
+            sc.Close();
+        }
+    }
+}
+
+Database : Table1 is defined as having two columns : ID (integer) and
+Val1 (ntext). For simplicity no PK was defined.
+


More information about the mono-bugs mailing list