>>Stupid and Lazy?
Well, I confess that I am not the brightest star in the sky - stupid?
hmmm - could be. Lazy? You betcha!!!
That is the beauty of .Net!!!!
It is precisely for the stupid and lazy. It makes us look like we are
the brightest starts in the sky. That is what I mean about easy.
Microsoft has taken the best elements of the Access paradigm and
integrated them into the .Net model. That is the whole point. You
think I can write complex MFC code (which is what Access and .Net are
all based on) ? You gotta be kidding! Well, actually, I have delved a
little into MFC (and Java and a few other technologies).
Access is still fundamentally a great tool. But it was just timne to
add OOP functionality to the model. How to do that? Build a whole new
model based on the old model. Adding OOP to the Access paradigm through
..Net has extended functionality by over 1000%, and .Net holds your hand
every inch of the way (well, at least VB.Net does - even C# to a
degree). It makes stupid guys look like they actually know what they
are doing. Between the .Net Error catching engine (which will slap your
hand every inch of the way and point out suggested fixes on the spot)
and the encapsulation of tons of API code, .Net reduces spaghetti code
significantly. STuff that could take 100 lines of code in VBA may take
only 10 lines in VB.Net (or even C# - well maybe 20 lines in C#).
AS for Transfer spreadsheet, one other trick would be to try automation.
You can use the Excel UsedRAnge property of the range object to read the
contents of the used range. This is kind of what TransferSpreadhsset
does. Then you can loop through the range object (from access) and read
each value of each row into a string and write that row to a table using
an ADO command object - something like this:
(make a reference to the Excel library)
Dim xl as New Excel.Application, wb as Excel.WorkBook, Sht as
Exce.WorkSheet, rng AS Excel.Range
dim cmd As New ADODB.Command, str1 AS String
Dim i As Integer, j As Integer
cmd.ActiveConnection = "..."
Set wb = xl.Workbooks.Open(...)
Set sht = wb.Sheets("Sheet1")
set rng = sht.UsedRange
For i = 1 to rng.rows.count
For j = 1 to rng.Columns.Count
if str1 <"" Then str1 = str1 & ", "
str1 = str1 & rng(i, j)
Next
cmd.CommandTExt = "Insert into your tbl Select " & str1
cmd.Excecute
Next
cmd.ActiveConnection.Close
In .Net you would use an OleDB DataAdapter and a SqlDataAdapter (these
are components of ADO.Net) to read from Excel and write to the Sql
Server DB. There is no looping involved which is similar to
TransferSpreadsheet which does not use looping - just a big data push.
Rich
*** Sent via Developersdex
http://www.developersdex.com ***