string or binary data would be truncated using asp.net

Posted by Mandlaa under ASP.NET on 5/20/2013 | Points: 10 | Views : 1276 | Status : [Member] | Replies : 1
CREATE TABLE [dbo].[Loyality1111](
[ID] [int] IDENTITY(1,1) NOT NULL primary key,
[ClientId] [int] NULL,
[CouponType] [varchar](50) NULL,
[Store] [nvarchar](15) NULL,
[CouponValueType] [varchar](50) NULL,
[CouponValue] [int] NULL,
[ValidUntil] [datetime] NULL,
[ImageName] [varchar](50) NULL,
[ImagePath] [nvarchar](max) NULL,
[CouponSentDate] [datetime] NULL,
)
At the time of inserting data through asp.net choose a image path i am getting following error:string or binary data would be truncated




Responses

Posted by: lakhansin-22735 on: 6/27/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

[ImagePath] [nvarchar](max) NULL by using this you want to store only the image path or image path + filename correct?

But, if your motive is to store file in database then you have to change the 'ImagePath' field datatype from 'nvarchar' to 'image', and from ASPX page pass a byte datatype value.

Is this make sense?



Lakhan Singh
Tech Lead
BeyondKey System Pvt. Ltd.
Indore, M.P.
India

Mandlaa, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response