public void save_Image(int id, byte []ar) { SqlCommand cmd = new SqlCommand(); cmd.CommandText="insert into tbimage values(@id,@nam)"; cmd.Connection=con; cmd.Parameters.Add("@id",SqlDbType.Int).Value=id; cmd.Parameters.Add("@nam",SqlDbType.Image).Value=ar; cmd.ExecuteNonQuery(); cmd.Dispose(); }
protected void Button1_Click(object sender, EventArgs e) { abc.WebService obj = new abc.WebService(); int ln = FileUpload1.PostedFile.ContentLength; byte []arr=new byte[ln]; FileStream fs = new FileStream(FileUpload1.PostedFile.FileName,FileMode.Open,FileAccess.Read); fs.Read(arr, 0, ln - 1); fs.Close(); obj.save_rec(Convert.ToInt32(TextBox1.Text),arr); TextBox1.Text = string.Empty; TextBox1.Focus(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)