How to insert varbinary dat in sqlserverce

I have a small asp.net application to store data in sqlserverce, how can I install varbinary (max) in sqlserver ce.i wrote code like this

    string filepath = Server.MapPath("~/App_Data/") + txtuname.Text + ".sdf";
    SqlCeConnection conn = new SqlCeConnection(@"Data Source=" + filepath);
    conn.Open();
    SqlCeCommand cmdCreate = new SqlCeCommand("CREATE TABLE Mybusinessapp_Pictures (Id int IDENTITY(1,1)PRIMARY KEY, Name nchar(50),Description nvarchar(500),Data varbinary(510),ImageUrl nvarchar(500))", conn);
    cmdCreate.ExecuteNonQuery();
    MessageBox.Show("Table created:");

When I try to insert data into this, it shows an error like

The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = varbinary ]

What happened help me ...

+3
source share
1 answer

Using image data type, varbinary (MAX) is not supported by SQL Server Compact

+1
source

All Articles