Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default object reference not released when using ADO.NET

Hi Experts,

I am using ado.net to export data to excel 2002 with oledb like the
following (this a sample code from MSDN) --

Dim sConnectionString As String
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sSampleFolder & _
"Book7.xls;Extended Properties=Excel 8.0;"
Dim objConn As New
System.Data.OleDb.OleDbConnection(sConnectionStrin g)
objConn.Open()

'Add two records to the table named 'MyTable'.
Dim objCmd As New System.Data.OleDb.OleDbCommand()
objCmd.Connection = objConn
objCmd.CommandText = "Insert into [Sheet1$] (FirstName, LastName)" & _
" values ('Bill', 'Brown')"
objCmd.ExecuteNonQuery()
objCmd.CommandText = "Insert into [Sheet1$] (FirstName, LastName)" & _
" values ('Joe', 'Thomas')"
objCmd.ExecuteNonQuery()

'Close the connection.
objConn.Close()
objConn.Dispose()
objCmd = Nothing
objConn = Nothing
GC.Collect()

I have two problems:

1) when the excel program is closed, there is still a reference to Excel
listed under "Task Manager". What else do I need to do to clear that
reference?
2) It seems there is no control to which row the first data set will be
inserted. Data will be keeping inserted to the next row. Even you save the
workbook and reoped, the new data will be inserted to the next empty row. Is
there any way to tell the program the starting row?


Thanks for your kind help

--
jshen
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ANN: XMLMax Virtual XML Editor Released Chris Excel Discussion (Misc queries) 0 September 30th 09 06:55 PM
Is Excel 2007 released ? Shirish New Users to Excel 2 April 6th 06 07:59 PM
when is the next microsoft office excel going to be released? Cyndi(KCMO) Excel Discussion (Misc queries) 2 March 17th 06 02:13 PM
Excel 12 - Information Released Jim Cone Excel Programming 0 September 23rd 05 06:52 PM
excel not being released by vb.net Mike[_55_] Excel Programming 0 October 3rd 03 03:10 PM


All times are GMT +1. The time now is 06:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"