Re: nvarchar to string
by Andreas H=?ISO-8859-1?Q?=E5kansson?= other posts by this author
Jul 2 2002 11:06AM messages near this date
Archive download?
|
Re: Last! (NOT)
Look at the Convert class it has a methods to convert to and from
loads of types. Check the Convert.ToString() convert method. Not
100% it will do the trick but it should.
>
> I was trying to do a little dot net proj to list all sp's and their
> definitions:
>
> sProcName = CStr(lstSP.Items.Item(lCount))
> cmd = New SqlCommand("sp_HelpText", cn)
> cmd.CommandType = CommandType.StoredProcedure
> cmd.Parameters.Add("@objname", sProcName)
> dr = cmd.ExecuteReader
> If dr.Read Then
> sCreate = ""
> iPosnText = dr.GetOrdinal("Text")
> Do
> sLine = CStr(dr.GetSqlString(iPosnName).Value)
> sCreate = String.Concat(sCreate, sLine)
> Loop Until Not dr.Read
> lblSP.Text = sAlter
> lblSP.Refresh()
> Write(iFileHandle, sCreate)
> End If
> dr.Close()
>
> what happens is that text is nvarchar
>
> i get back where [] is an undisplayable char
>
> "[] create procedure ...
>
> this seems to me to be a unicode string?
> how to I get it into a text string? - I've tried .tostring, cstr()
>
> please (oh and please dont retire the list)
>
> Many thanks
>
> Ian
>
> You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
> subscribe to other DevelopMentor lists at http://discuss.develop.com.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.
|