oledb

Unable to Connect to Excel via SSIS

一世执手 提交于 2019-12-23 17:16:29
问题 Excel file is not being recognized by SSIS. Error : Could not retrieve table information from connection manager "Excel Connection Manager Failed to connect to the source using the connection manager 'Excel Connection Manager' I have tried installing 32-bit of redistributable which resolved this error but when I run this outside using SQL stored procedure it is failing, which is in turn resolved if i install 64 of redistributable but this is failing in SSIS, Hence, I need 32-bit to run in SP,

oledb/ado.net: Get the command's text, with all parameters replaced

和自甴很熟 提交于 2019-12-23 14:22:22
问题 Is it possible to get the text of an OleDbCommand with all parameters replaced with their values? E.g. in the code below I'm looking for a way to get the query text SELECT * FROM my_table WHERE c1 = 'hello' and c2 = 'world' after I finished assigning the parameters. var query = "SELECT * FROM my_table WHERE c1 = ? and c2 = ?"; var cmd = new OleDbCommand(query, connection); cmd.Parameters.Add("@p1", OleDbType.WChar).Value = "hello"; cmd.Parameters.Add("@p2", OleDbType.WChar).Value = "world";

oledb/ado.net: Get the command's text, with all parameters replaced

拈花ヽ惹草 提交于 2019-12-23 14:22:06
问题 Is it possible to get the text of an OleDbCommand with all parameters replaced with their values? E.g. in the code below I'm looking for a way to get the query text SELECT * FROM my_table WHERE c1 = 'hello' and c2 = 'world' after I finished assigning the parameters. var query = "SELECT * FROM my_table WHERE c1 = ? and c2 = ?"; var cmd = new OleDbCommand(query, connection); cmd.Parameters.Add("@p1", OleDbType.WChar).Value = "hello"; cmd.Parameters.Add("@p2", OleDbType.WChar).Value = "world";

c# Error inserting to Excel when string data is more than 255 chars

孤人 提交于 2019-12-23 12:28:42
问题 I am trying to export some data to Excel. I am using OLEDB 12. The connectio string looks like: "Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES;'" And I use an INSERT query. But whenever the data in a target column exceeds 255 chars, I get an exception. Exception Details: System.Data.OleDb.OleDbException: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. There is a similar post on SO: Excel

OLE CALL to Excel with WHERE clause

删除回忆录丶 提交于 2019-12-23 10:42:30
问题 I am working on fixing a C# project which uses an Excel sheet with data definition to create a .fmt file used by a bulk insert in SQL Server. My issue is that the Excel files sometimes have blank rows at the bottom and the C# parser I am working on will detect a number of rows superior to the actual number of rows containint data definition. The fmt file therefore has a larger number of rows on its second line and bulk insert throws an exception when it reaches the bottom and tries to read on

No read permission on MSysObject error

倾然丶 夕夏残阳落幕 提交于 2019-12-23 10:41:03
问题 I am trying to connect to an MS Access database (.mdb) through OleDb . My query is SELECT * FROM ListQueries which fetches me the error SQL Execution Error. Executed SQL Statement: SELECT * FROM ListQueries Error Source: Microsoft JET Database Engine Error Message: Records cannot be read; No read permission on 'MSysObjects'. Then I tried this answer, but it did not help. Then I saw another answer says to do this. strDdl = "GRANT SELECT ON MSysObjects TO Admin;" CurrentProject.Connection

No read permission on MSysObject error

冷暖自知 提交于 2019-12-23 10:40:01
问题 I am trying to connect to an MS Access database (.mdb) through OleDb . My query is SELECT * FROM ListQueries which fetches me the error SQL Execution Error. Executed SQL Statement: SELECT * FROM ListQueries Error Source: Microsoft JET Database Engine Error Message: Records cannot be read; No read permission on 'MSysObjects'. Then I tried this answer, but it did not help. Then I saw another answer says to do this. strDdl = "GRANT SELECT ON MSysObjects TO Admin;" CurrentProject.Connection

I didn't close previous DataReader, but where?

自古美人都是妖i 提交于 2019-12-23 09:57:34
问题 I have changed my previous code so I am not using 'using'. It work earlier, and code in different class basically represent the same thing, but its working. I have stared at it for 2 hours now and I just can't figure out where the problems might be. I have only one reader but each time I am using DisplayFileContent method I am getting the error: Error: There is already an open DataReader associated with this command which must be closed first. // May be public so we can display // content of

SSIS OLEDB destination with SQL command

对着背影说爱祢 提交于 2019-12-23 08:12:22
问题 I have a simple SSIS package with a data flow task with ADO.NET source & destination: Normally, I would just select 'table or view' on the OLEDB destination, but although the connection is correct it's not showing me any table names. So: I have to use SQL command to insert rows in the OLE DB destination. That destination is a DB2 database. My question: how can I write this sql statement to insert everything from the ANO NET source into the destination table? 回答1: In the SQL Command Text, Just

SSIS OLEDB destination with SQL command

纵饮孤独 提交于 2019-12-23 08:12:18
问题 I have a simple SSIS package with a data flow task with ADO.NET source & destination: Normally, I would just select 'table or view' on the OLEDB destination, but although the connection is correct it's not showing me any table names. So: I have to use SQL command to insert rows in the OLE DB destination. That destination is a DB2 database. My question: how can I write this sql statement to insert everything from the ANO NET source into the destination table? 回答1: In the SQL Command Text, Just