i tried to update the binary data to a sqltable from .net.i used the codings like this
BinaryReader
error:
Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query.
error will occur how can i solve this
br = new BinaryReader(FileUpload1.PostedFile.InputStream);byte[] b1 = br.ReadBytes(FileUpload1.PostedFile.ContentLength);
string strconn = @"data source=.\sqlexpress;initial catalog=jobs;uid=sa;pwd=as";
SqlConnection conn = new SqlConnection(strconn);
string q1 = "update register set resume='" + b1 + "' where id='" + id1+ "'";
SqlCommand cmd = new SqlCommand(q1, conn);
SqlDataReader rdr = null;
rdr = cmd.ExecuteReader();

Soft CornerRank #1,221 · 1.5K reputationPosted Mar 28, 2011, 10:29 PM EDT
1. Check with Datatype of Column in Database, i think u have varchar column in DB
2. & Seems to be you are wrong at this statement
SqlDataReader rdr = null;
rdr = cmd.ExecuteReader();
[No need of these two line, remove it from code]
As your query is Updating the table, so use cmd.ExecuteNonQuery()
karthi vimala38 reputationPosted Mar 28, 2011, 10:37 PM EDT
in table alos i mentioned varbinary(max).after i changed the executenonquery the error
Error 1 Cannot implicitly convert type 'int' to 'System.Data.SqlClient.SqlDataReader'
error will occur
Soft CornerRank #1,221 · 1.5K reputationPosted Mar 28, 2011, 10:51 PM EDT
Show me your updated code, let me check here.
karthi vimala38 reputationPosted Mar 28, 2011, 11:06 PM EDT
sorry,i got it,i done th error in the line rdr=cmd.executereader();
i correct it by cmd.executenonquery();
karthi vimala38 reputationPosted Mar 28, 2011, 11:10 PM EDT
now i used like this
string q1 = "insert into register(resume) values(@resume) where id = '" + id1 + "'";
SqlCommand cmd = new SqlCommand(q1, conn);cmd.Parameters.Add(new SqlParameter("@resume", (object)b1));
cmd.ExecuteNonQuery ();
the error:
Incorrect syntax near the keyword where error will occur,