Thursday, March 22, 2012

Textarea to sql 2000 text datatype

Hi All,
Does anyone have any example of asp.net code for saving a
textarea into a text/ntext column in sql table?

thanks

slyiShouldn't be any different to storing any other type of data.
Are you having problems testing this normally?

Just create a Stored Procedure to do it, and set the parameter.
Worked for me

HTH

My Example:

*****************
Sql
******************

CREATE PROCEDURE [spname]
@.MyNTextParam NTEXT
AS

INSERT INTO MYTABLE VALUES(@.MyNTextParam)

*************
c#
*************

SqlCommand cmd = new SqlCommand([spname], [connectionstring]);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.add(new SqlParameter("@.MyNTextParam". SqlDbType.NText)).Value
= MyTextArea.Text;

//Open connection and execite cmd

<adrianca@.gmail.com> wrote in message
news:1124282549.563896.53910@.o13g2000cwo.googlegro ups.com...
> Hi All,
> Does anyone have any example of asp.net code for saving a
> textarea into a text/ntext column in sql table?
> thanks
> slyi
Thank you thats perfect.
i just see any examples on the web for this :o(

0 comments:

Post a Comment