Unable save the attachment file in database.
below is my code
protected void btn_Upload_Click(object sender, EventArgs e)
{
if (FileToUpload.PostedFile == null || String.IsNullOrEmpty(FileToUpload.PostedFile.FileName) || FileToUpload.PostedFile.InputStream == null)
{
lit_Status.Text = "<br />Error - unable to upload file. Please try again.<br />";
}
else
{
using ( SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dbConnectionString"].ToString()))
{
try
{
const string SQL = "INSERT INTO [tbltransaction] ([attachment]) VALUES (@attachment)";
SqlCommand cmd = new SqlCommand(SQL, sqlCon);
...
Go to the complete details ...