c# - MonoMac Console Application Returns Only First Character of nvarchar(max) -


i have console application run on mac os x through mono. although executes correctly on windows os, returns first character of nvarchar(max) variable. here c# code:

sqlconnection myconnection = new sqlconnection(variables.connectionstring()); sqlcommand mycommand = new sqlcommand("indexpagedetailsget", myconnection); mycommand.commandtype = commandtype.storedprocedure; sqlparameter parameterindexpageid = new sqlparameter("@indexpageid", sqldbtype.int); parameterindexpageid.value = indexpageid; mycommand.parameters.add(parameterindexpageid); sqlparameter parameterindexpagetext = new sqlparameter("@indexpagetext", sqldbtype.nvarchar, -1); parameterindexpagetext.direction = parameterdirection.output; mycommand.parameters.add(parameterindexpagetext); myconnection.open(); mycommand.executenonquery(); myconnection.close(); return (string)parameterindexpagetext.value; // returns first character 

and here stored procedure:

alter procedure [dbo].[indexpagedetailsget] ( @indexpageid int, @indexpagetext nvarchar(max) output ) select @indexpagetext = indexpagetext indexpages indexpageid = @indexpageid 

has else witnessed behavior and/or know how work around it?

edit: here mono version information:

monodevelop 3.0.3.2
runtime:
mono 2.10.9 (tarball)
gtk 2.24.10
gtk# (2.12.0.0)
package version: 210090011

i found workaround this. instead of using stored procedure returns string, used 1 returns sqldatareader. allows me string full nvarchar(max) value. hence, in c#:

string indexpagetext = string.empty; sqlconnection myconnection = new sqlconnection(variables.connectionstring()); sqlcommand mycommand = new sqlcommand("indexpagesgetbyindexpageid", myconnection); mycommand.commandtype = commandtype.storedprocedure; sqlparameter parameterindexpageid = new sqlparameter("@indexpageid", sqldbtype.int); parameterindexpageid.value = indexpageid; mycommand.parameters.add(parameterindexpageid); myconnection.open(); sqldatareader result = mycommand.executereader(commandbehavior.closeconnection); while (result.read()) { indexpagetext = (string)result["indexpagetext"]; break; } result.close(); indexpagedetails.indexpagetext = indexpagetext; 

and stored procedure:

alter procedure [dbo].[indexpagesgetbyindexpageid] ( @indexpageid int ) select * indexpages indexpageid = @indexpageid 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -