Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tkota
Starting Member
1 Post |
Posted - 2008-05-19 : 19:42:41
|
| Hello,My datalayer of C# code is invoking a stored procedure that returns a varchar(max) SQL data type. In my ASP.NET code, I have:SqlCommand myCommand = new SqlCommand("usp_GetTestString", myConnection);myCommand.Parameters.Add(new SqlParameter("@TestString", SqlDbType.Text));myCommand.Parameters["@TestString"].Direction = ParameterDirection.Output;myConnection.Open();myCommand.ExecuteNonQuery();return Convert.ToString(myCommand.Parameters["@TestString"].Value);The query fails to execute and returns an error: String[1]: the Size property has an invalid size of 0. If I change the SqlDbType.Text parameter type to SqlDBType.Varchar, 100 (or any other fixed varchar length), it works but limits the length my unlimited field text. Any suggestions on how I can use db type text or varchar(max)? The field I need to retrieve is string characters of unlimited length and hence the datatype varchar(max). |
|
|
|
|
|