Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft Access > Re: TransferSpr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 12 Topic 30197 of 31596
Post > Topic >>

Re: TransferSpreadsheet to .ADP dbo table

by Rich P <rpng123@[EMAIL PROTECTED] > May 9, 2008 at 10:46 AM

>>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
***
 




 12 Posts in Topic:
TransferSpreadsheet to .ADP dbo table
D.Stone@[EMAIL PROTECTED]  2008-05-08 07:59:17 
Re: TransferSpreadsheet to .ADP dbo table
D.Stone@[EMAIL PROTECTED]  2008-05-08 08:58:24 
Re: TransferSpreadsheet to .ADP dbo table
Rich P <rpng123@[EMAIL  2008-05-08 17:15:44 
Re: TransferSpreadsheet to .ADP dbo table
lyle fairfield <lyle.f  2008-05-08 15:30:31 
Re: TransferSpreadsheet to .ADP dbo table
Rich P <rpng123@[EMAIL  2008-05-08 18:37:43 
Re: TransferSpreadsheet to .ADP dbo table
lyle fairfield <lyle.f  2008-05-08 21:19:22 
Re: TransferSpreadsheet to .ADP dbo table
lyle fairfield <lyle.f  2008-05-08 21:31:31 
Re: TransferSpreadsheet to .ADP dbo table
rkc <rkc@[EMAIL PROTEC  2008-05-09 12:40:36 
Re: TransferSpreadsheet to .ADP dbo table
lyle fairfield <lyle.f  2008-05-09 18:56:10 
Re: TransferSpreadsheet to .ADP dbo table
lyle fairfield <lyle.f  2008-05-08 18:58:33 
Re: TransferSpreadsheet to .ADP dbo table
D.Stone@[EMAIL PROTECTED]  2008-05-09 02:32:59 
Re: TransferSpreadsheet to .ADP dbo table
Rich P <rpng123@[EMAIL  2008-05-09 10:46:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 11:32:34 CST 2008.