charan sekhar

charan sekhar

  • NA
  • 108
  • 0

System.Data.SqlClient.SqlException: SQL Server Internal Error. Text manager cannot continue with current statement.

May 14 2010 6:58 AM
 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Safa"].ConnectionString);

string branchid = "";
protected void Page_Load(object sender, EventArgs e)
{
branchid= Session["branchid"].ToString();
if (IsPostBack == false)
{
Image1.ImageUrl = "left1.ashx?BranchId=" + branchid;
Image2.ImageUrl = "left1old.ashx?BranchId=" + branchid;



}

protected void Button1_Click(object sender, EventArgs e)
{
// update code
SqlCommand cmdupdate = new SqlCommand("left1update", con);
cmdupdate.CommandType = CommandType.StoredProcedure;
con.Open();
cmdupdate.Parameters.AddWithValue("@BranchId", branchid);

if ( FileUpload1.HasFile)
{
FileInfo left1info = new FileInfo( FileUpload1.PostedFile.FileName.Trim());
byte[] left1content = new byte[left1info.Length];
FileStream left1stream = left1info.OpenRead();
left1stream.Read(left1content, 0, left1content.Length);
left1stream.Close();
cmdupdate.Parameters.AddWithValue("@imgleft1",left1content);
}
cmdupdate.Parameters.AddWithValue("@notel1",txtnotes.Text);


if(cmdupdate.ExecuteNonQuery()!=0)
{
Functions.ShowAlertMessage("Updated.....");
txtnotes.Text = "";
System.Threading.Thread.Sleep(2000);
Image1.ImageUrl = "left1.ashx?BranchId=" + Session["branchid"].ToString();
Image2.ImageUrl = "left1old.ashx?BranchId=" + Session["branchid"].ToString();

}

 
procedure iam using

create procedure left1update(@BranchId nvarchar(50),@imgleft1 image, @notel1 nvarchar(200))
as
update tblImages set imgleft1old= CONVERT( image,imgleft1)
,imgleft1=@imgleft1 ,notel1=@notel1 where (BranchId=@BranchId)


GO

when iam clicking the button my current image should store in imgleft1old field and the newly browse one should store in imgleft1 field

but it giving error
System.Data.SqlClient.SqlException: SQL Server Internal Error. Text manager cannot continue with current statement.



can you correct my code which helps me