Scanning a file?

  • Thread starter Thread starter Marie-Christine Bechara
  • Start date Start date
M

Marie-Christine Bechara

I have a form with a button called btnScan. When i click on this button
i want to scan a file and save it in the database. Any hints?? ideas???
solutions???
 
what is scanning here? do you need to get some data out of the file. if so
you can open the file and do it the normal way.

Av.
 
Marie-Christine Bechara said:
I have a form with a button called btnScan. When i click on this button
i want to scan a file and save it in the database. Any hints?? ideas???
solutions???



Hi,

Hi,

What I did was the following:
(Inside the Eventhandler for the button click!)

Open the file - Parse the lines - Close the File - Generate SQL
statement - Execute the statement


Example:

MySQLString sql = new MySQLString();
StreamReader sr = new
StreamReader(tmp.DIOFile,System.Text.Encoding.Default);

string actLine;

while( (actLine = sr.ReadLine()) != null )
{
#region Process the Data Here
sql.SQLCommand = "INSERT INTO DBTBL.name VALUES ('"+actLine+"')";
#endregion
}

sr.Close();

#region PROCESS ODBC STUFF HERE
if(ODBCConnection.State != ConnectionState.Open)
ODBCConnection.Open();

OdbcCommand comm = new OdbcCommand(sql.SQLCommand, ODBCConnection);

try
{
comm.ExecuteNonQuery();
comm.Dispose();
}
catch(OdbcException ex)
{
MessageBox.Show(ex.Errors[0].Message);
ODBCConnection.Close();
return;
}

ODBCConnection.Close();

#endregion


Hope this is what you are looking for,

Martin
 
I mean by scanning the actual scanning of a document using the Scanner.
When i click on the Scan button, i need some kind of functionality that
allows me to scan.
 
Marie-Christine Bechara said:
I mean by scanning the actual scanning of a document using the Scanner.
When i click on the Scan button, i need some kind of functionality that
allows me to scan.
Sorry,

no experience with this one!

Martin
 
Hi Marie ..

Working with the scanner can be tricky, I have no much experience in that
field so I will just give you hints of what to search, no the solution
itself, the scanners IIRC use a protocol named TWAIN to comunicate, if you
do a search for TWAIN and scanner in google groups :
http://groups.google.com/groups?hl=...e+Search&meta=group=microsoft.public.dotnet.*

you will get several posts, take a look at them and maybe you find a
solution :)
If you do , please post it back here to be archived.

Cheers,
 
Back
Top