This code will convert ur image to proper format by which u can save ur image to ur database.
private void btnBrowse_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = @"C:\";
openFileDialog1.Title = "Select Ur Image File";
openFileDialog1.Filter = "All Files (*.*)|*.*";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;
openFileDialog1.ReadOnlyChecked = true;
openFileDialog1.ShowReadOnly = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
tbUpload.Text = openFileDialog1.SafeFileName;
string FilePath;
FilePath = openFileDialog1.FileName;
if (openFileDialog1.FileName != null)
{
System.IO.FileStream fs = new System.IO.FileStream(FilePath, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
System.IO.BinaryReader binaryReader = new System.IO.BinaryReader(fs);
long byteLength = new System.IO.FileInfo(FilePath).Length;
byte[] Attachmnt;
Attachmnt = binaryReader.ReadBytes((Int32)byteLength);
fs.Close();
fs.Dispose();
binaryReader.Close();
}
}
}
Now u can store the value of {Attachmnt} through storedprocedure or query into ur database.(But the column where u want to put ur image (Attachmnt) should be type "iamge")
Here i explained it throuth openfiledialog by Browse button,where u will select ur image.
But i have no idea about watermarking through program.