0

I am new in using TWAIN in scanning documents. I have already managed to scan documents but stuck at storing them. Here is a sample of my code. (Without the CONVERT command before the "ddnTwain.CurrentImageIndexInBuffer" I get an error saying I should use the CONVERT function and I did xD)

    con.Open();
    cmd = new SqlCommand(@"INSERT INTO FileArchive"
                           (FFTitle, FDesc, FIssuer, FType, FFile,
                            FDatePassed, FDatestored, FAuthentication,
                            FStoredby)
                           VALUES
                           ('"+txtscanTitle.Text+"','"+txtscanDesc.Text+@"',
                           '"+txtscanIssuer.Text+"', '"+ScanFT+"',(CONVERT(varbinary(max),'"+ddnTwain.CurrentImageIndexInBuffer+@"')),
                           '"+ScanDP+@"',
                           '"+DateTime.Now.Date.ToShortDateString()+@"',
                           'Authenticated', '"+SBName.Text+"')", con);
    cmd.ExecuteNonQuery();
    con.Close();
Noobie
  • 293
  • 1
  • 3
  • 9
  • you can store the images as array of bytes in the db or as base64string, in both cases, you can have a look to this solution i provided on different question, but i believe it will help you: http://stackoverflow.com/a/18827264/2718699 – Monah May 01 '16 at 06:32
  • Thanks for you help! Looking at it right now. – Noobie May 01 '16 at 07:06

0 Answers0