[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

kkarre

9/29/2007 12:41:00 PM

Hi,
I'm building a VSTO solution for Excel.
When trying to use dataset designer to create datatables and tableadapters I
get into trouble:
VS 2005 won't connect to Excel!
In the Add Connection I use this driver:Microsoft ODBC Data Source (ODBC)
I choose 'Excel files' and the connection seems to be OK.
When building the query I'm asked to choose 'table' (which in Excel is
sheet); promising!
When I try to run the query I get SQL Execution Error.
Error Source ACEODBC.dll
Error Message: ERROR [HV000][Microsoft][ODBC driver for Excel] The
connection to Excel was closed. The linked sheet can not be shown (Free
translation from Swedish error message).
Could it be because I've got two Excel versions on my laptop? 2003 & 2007...

It's very frustrating to spend hours and hours on a problem that might not
be possible to solve, so if anyone can tell me if I'm doing something wrong I
would very much appreciate it!

Best regards,
kk
2 Answers

kkarre

10/1/2007 8:01:00 PM

0

Wow:
When I uninstall Office 2003 VS 2005 dataset designer lets me connect to XL
files.
I can preview data and everything.
But, of course, when I try to run the project I get an error because there's
stuff missing. I reinstall Office 2003 - still doesn't work.
I reinstall VSTO - now the code runs BUT the TableAdapter CANNOT connect!

So, how should this be corrected?
PLEASE!?
/kkarre

"kkarre" wrote:

> Hi,
> I'm building a VSTO solution for Excel.
> When trying to use dataset designer to create datatables and tableadapters I
> get into trouble:
> VS 2005 won't connect to Excel!
> In the Add Connection I use this driver:Microsoft ODBC Data Source (ODBC)
> I choose 'Excel files' and the connection seems to be OK.
> When building the query I'm asked to choose 'table' (which in Excel is
> sheet); promising!
> When I try to run the query I get SQL Execution Error.
> Error Source ACEODBC.dll
> Error Message: ERROR [HV000][Microsoft][ODBC driver for Excel] The
> connection to Excel was closed. The linked sheet can not be shown (Free
> translation from Swedish error message).
> Could it be because I've got two Excel versions on my laptop? 2003 & 2007...
>
> It's very frustrating to spend hours and hours on a problem that might not
> be possible to solve, so if anyone can tell me if I'm doing something wrong I
> would very much appreciate it!
>
> Best regards,
> kk

kkarre

10/1/2007 8:29:00 PM

0

The error occurs in the TableAdapter:

Error message:
System.Data.Odbc.OdbcException: ERROR [IM006] [Microsoft][ODBC Driver
Manager] Driver's SQLSetConnectAttr failed
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle,
RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection,
OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection
outerConnection, OdbcConnectionString connectionOptions)
at
System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions
options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32
startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at
Lemurtyper.dsDefinitionerTableAdapters.ProduktDefinitionTableTableAdapter.Fill(ProduktDefinitionTableDataTable
dataTable) in C:\Documents and Settings\Kristian
Karre\Desktop\Lemur2007maj\LemurClassLibrary\dsDefinitioner.Designer.vb:line
1610
at Lemur.ThisWorkbook.TankaDefinitioner() in C:\Documents and
Settings\Kristian Karre\Desktop\Lemur2007maj\Lemur\ThisWorkbook.vb:line 548
at Lemur.ThisWorkbook.ThisWorkbook_Startup(Object sender, EventArgs e) in
C:\Documents and Settings\Kristian
Karre\Desktop\Lemur2007maj\Lemur\ThisWorkbook.vb:line 435
at Microsoft.Office.Tools.Excel.Workbook.OnStartup()
at Lemur.ThisWorkbook.FinishInitialization() in C:\Documents and
Settings\Kristian
Karre\Desktop\Lemur2007maj\Lemur\ThisWorkbook.Designer.vb:line 67
at
Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecutePhase(String methodName)
at
Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecuteCustomizationStartupCode()
at
Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.ExecuteEntryPointsHelper()
at
Microsoft.VisualStudio.Tools.Applications.Runtime.AppDomainManagerInternal.Microsoft.VisualStudio.Tools.Applications.Runtime.IExecuteCustomization2.ExecuteEntryPoints()