| Author |
Topic |
|
mrtanvirali
Starting Member
41 Posts |
Posted - 2008-12-02 : 08:57:35
|
| Dear All,I want to save html tags into the database but the query giving me error that "Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query"I am using simple query:INSERT INTO NewsInfo (Id, News, PageId, Description) values(@Id, @News, @PageId, @Description)@News Consists of html string e.g. <p>hello world</p><strong>bold text</strong> etc.please help me to solve this |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-02 : 09:03:15
|
INSERT INTO NewsInfo (Id, News, PageId, Description) values(@Id, @News, @PageId, CAST(@Description AS VARBINARY(MAX))) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
jholovacs
Posting Yak Master
163 Posts |
Posted - 2008-12-02 : 14:13:47
|
| What is the DDL definition of the NewsInfo table?___________________________Geek At Large |
 |
|
|
mrtanvirali
Starting Member
41 Posts |
Posted - 2008-12-03 : 00:10:44
|
| Thanks both of you for reply,It was a little ddl fault:First DDL was: (jsut look at the Description field's datatype)INSERT INTO [IITSolutions].[dbo].[web_NewsInfo] ([UserId],[News],[PageId],[Description]) VALUES(<UserId, int,>,<News, varchar(3000),>,<PageId, int,>,<Description, varbinary(100),>)and i was storing '' into the description columnbut now i've changed Description field's datatype form varbinary to varchar, that's doneChanged: DDLINSERT INTO [IITSolutions].[dbo].[web_NewsInfo] ([UserId],[News],[PageId],[Description]) VALUES(<UserId, int,>,<News, varchar(3000),>,<PageId, int,>,<Description, varchar(100),>) |
 |
|
|
|
|
|