// create connection object
// open the database connection
foreach(FileInfo myFile in files)
{
// read the file into whatever variables if you please.
// create a command object
// populate the stored procedure if you are using one
// or populate the insert command
// execute the command using ExecuteNonQuery
// dispose the object
}
// close the connection
// dispose the connection
i am saying that you need to open the connection before the foreach because
you might have hell lot of files and you dont want to keep opening database
connection.
i have never reused command object but even that might be worth a try.
--
Regards,
Hermit Dave
(
http://hdave.blogspot.com)
"Peter Afonin" <pe***@gudzon.net> wrote in message
news:#G**************@TK2MSFTNGP12.phx.gbl...
Hello,
It should be a simple solution to this, I've just never done it and cannot
find any information so far.
I'm getting an array - the list of the files in the directory:
Dim dir As DirectoryInfo = New DirectoryInfo("\\10.0.0.150\FormLib")
Dim files() As FileInfo = dir.GetFiles("*.eps")
I need to put this array into a SQL server table. How can I do this?
I would appreciate your advice very much.
Thank you,
--
Peter Afonin