Results 1 to 6 of 6

Thread: scanner and picture box add to database

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2008
    Posts
    47

    scanner and picture box add to database

    Hello,
    I have a database with a blob field, I also have a twain activex to scan pictures to add them to the database. I use ado, the problem is when I scan the picture copy it to the picture box but when I press the accept changes button the picture from the picturebox is not inserting, only the data of the text components (text boxes) are inserting in the database.
    Any help???

    Kyriakos
    Last edited by kyriakos70; Dec 8th, 2011 at 02:23 AM. Reason: more clearer

  2. #2

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2008
    Posts
    47

    Re: scanner and picture box add to database

    VB .Net 2008

  4. #4
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: scanner and picture box add to database

    What Db are you using? Is the activeX supposed to save pictures to the database or just to the file system?
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2008
    Posts
    47

    Re: scanner and picture box add to database

    Hello,
    I am using sql server 2008, the activex is supposed to save images only to file system but it has a good parameter "save3picturebox" which enables me to scan a picture and then copy the scanned picture to a picturebox which I haveconnected to a database with a dataset in the databindings-image property, the picture is copied but when I press the button to
    Code:
    Me.BindingContext(DataSet21, "Table_1").EndCurrentEdit()
            SqlDataAdapter1.Update(DataSet21, "Table_1")
            DataSet21.AcceptChanges()
    accept the changes the picturebox clears it self from the picture and in the database are saved only the data from the textboxes, the database has other fields too which are string type and no master detail only one table. Is there any code/other way to insert to the blob field the scanned image?
    I am trying this but the code has errors :
    Code:
    mycommand = New SqlCommand("insert into Table_1([photo]) values ("  PictureBox3.Image  ")", me.SqlConnection1 )

  6. #6
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: scanner and picture box add to database

    Replace this
    Code:
    mycommand = New SqlCommand("insert into Table_1([photo]) values ("  PictureBox3.Image  ")", me.SqlConnection1 )
    with this
    Code:
    mycommand = New SqlCommand("insert into Table_1([photo]) values (" & PictureBox3.Image & ")", me.SqlConnection1 )
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width