private int WriteToDB(string strName, string strType, ref byte[] Buffer)
{
    int nFileID = 0;
    OleDbConnection dbConn = new OleDbConnection(GetConnectionString());
    OleDbDataAdapter dbAdapt = new OleDbDataAdapter("SELECT * FROM tblFile", dbConn);
    dbAdapt.MissingSchemaAction = MissingSchemaAction.AddWithKey;
    OleDbCommandBuilder dbCB = new OleDbCommandBuilder(dbAdapt);
    dbConn.Open();
    DataSet dbSet = new DataSet();
    dbAdapt.Fill(dbSet, "tblFile");
    DataTable dbTable = dbSet.Tables["tblFile"];
    DataRow dbRow = dbTable.NewRow();
    dbRow["FileName"] = strName;
    dbRow["FileSize"] = Buffer.Length;
    dbRow["ContentType"] = strType;
    dbRow["FileData"] = Buffer;
    dbTable.Rows.Add(dbRow);
    dbAdapt.Update(dbSet, "tblFile");
    if( !dbRow.IsNull("FileID") ) nFileID = (int)dbRow["FileID"];
    dbConn.Close();
    return nFileID;
}