3

I have develop a small asp.net application to store the data into sqlserverce ,How can i set varbinary(max) in sqlserver ce.i have wrote the 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 showing error like

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

What is was the wrong please help me...

1
  • Anybody help me please ....... how to insert the binary image data into sqlserverce Commented Jun 6, 2011 at 8:07

1 Answer 1

1

Use the image data type, varbinary(MAX) is not suported by SQL Server Compact

Sign up to request clarification or add additional context in comments.

3 Comments

Hi thank you for giving response why it is showing Type to convert from (if known) = nvarchar error....
Hi i have change the data type from varbinary to image but this one also showing error like "The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = image ] please help me.
Hi thank you for giving response i have solve that my problem..Thank you so much...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.