jet

Querying Jet Databases/Excel files with C# under x64 OS

最后都变了- 提交于 2019-12-10 10:24:14
问题 So I have learned that that the Microsoft.Jet.OLEDB.4.0 data provider for querying data sources like Microsoft Access MDB files and Excel spreadsheets does not work under a Windows 64-bit operating systems. What I am now supposed to use to query against these file types in .NET 3.5 (C#) applications in order to ensure compatibility in both x86 and x64 environments? I have scoured the Internet and I cannot seem to find a straight answer on how to handle this incompatibility. I've also tried

The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine

浪尽此生 提交于 2019-12-10 03:50:29
问题 I am having a problem with my application. When it is run, the error displays The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. I tried changing Platform to X86 CPU but it could not be changed, the only available option is Any CPU. Please advise how to get rid of this error. Thanks 回答1: you are using the Jet.OLEDB.4.0 driver, which gives that error when run on 64 bit system, it is better to install the new driver Microsoft Access Database Engine 2010

How do I create a Microsoft Jet (Access) database without an interop assembly?

放肆的年华 提交于 2019-12-09 13:33:00
问题 I need to create an access (mdb) database without using the ADOX interop assembly. How can this be done? 回答1: Before I throw away this code, it might as well live on stackoverflow Something along these lines seems to do the trick: if (!File.Exists(DB_FILENAME)) { var cnnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DB_FILENAME; // Use a late bound COM object to create a new catalog. This is so we avoid an interop assembly. var catType = Type.GetTypeFromProgID("ADOX.Catalog"); object

Reading Comma Delimited Text File to C# DataTable, columns get truncated to 255 characters

限于喜欢 提交于 2019-12-09 06:49:17
问题 We are importing from CSV to SQL. To do so, we are reading the CSV file and writing to a temporary .txt file using a schema.ini. (I'm not sure yet exactly why are are writing to this temporary file, but that's how the code currently works). From there, we are loading a DataTable via OleDB using the following connection string (for ASCII files). "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sPath + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited\""; The problem we are having is that

Select Top (all but 10) from … in Microsoft Access

牧云@^-^@ 提交于 2019-12-09 02:34:41
问题 Say I've got a query SELECT TOP 10 ... FROM ... ORDER BY ... in Access (well, really Jet). The question is: how can I get all the other rows... everything except the top 10? 回答1: Couldn't you do something like SELECT ... FROM ... WHERE PK NOT IN (SELECT TOP 10 PK FROM ...) ORDER BY ... it might not be that efficient but that's the only way off the top of my head I can think to do something like that. AFAIK there's no "BOTTOM" clause in SQL :) 回答2: SELECT ... FROM .... WHERE myID NOT IN

MS-Access Including all days in a Date Range Query

醉酒当歌 提交于 2019-12-09 01:02:23
Access 2010 here. Back with another puzzler. I have this query: SELECT DischargeDatabase.Date, Avg([pH]) AS [pH Value], Avg([Temperature]) AS [Temperature (°C)], Avg([ZincLevel]) AS [Zinc (mg/l)], Sum([Effluent]) AS [Discharge (gal)], Count(*) AS [# Discharges] FROM DischargeDatabase WHERE DischargeDatabase.Date Between Forms!QueryForm!TextCriteriaQ0A And Forms!QueryForm!TextCriteriaQ0B GROUP BY DischargeDatabase.Date; from a waste water treatment database that I've been building. This gives a by-day summary of waste water discharges, averaging the pH, Temperature, and zinc levels, and summing

ADO.NET way for creating a linked table

旧城冷巷雨未停 提交于 2019-12-09 00:57:13
问题 I'm writing an application that uses ADO.NET OLEDB provider. Database is Access. Most of DB interaction is through DDL/DML SQL queries. I now need to create linked tables and there doesn't seem to be a way of doing that with ADO.NET alone. Neither in a simple DDL query, nor with trying to manipulate Access system tables directly. I'm trying to avoid using ADOX, with the extra reference/dependency in my application. Anyone knows a way around this? Much appreciated. Here's how I currently

Microsoft Access Compact and Repair using C# .accdb files

£可爱£侵袭症+ 提交于 2019-12-08 05:18:59
问题 I need to Compact and Repair .accdb (last MS Access) version using C# I tried using this: var jroEngine = new JRO.JetEngineClass(); var old_ = Provider=Microsoft.ACE.OLEDB.12.0;Data Source='c:\a.accdb'; var new_ = Provider=Microsoft.ACE.OLEDB.12.0;Data Source='c:\b.accdb'; jroEngine.CompactDatabase(old_, new_); Marshal.ReleaseComObject(jroEngine); There is an error: {"Invalid argument."} 回答1: This is probably the most straightforward way to do it: string sourceDbSpec = @"C:\Users\Public\a

Multiple LEFT JOIN in Access

▼魔方 西西 提交于 2019-12-07 08:02:27
问题 I have the following query, which works for MySQL: DELETE `test1`, `test2`, `test3`, `test4` FROM `test1` LEFT JOIN `test2` ON test2.qid = test1.id LEFT JOIN test3 ON test3.tid = test2.id LEFT JOIN test4.qid = test1.id WHERE test1.id = {0} But it doesn't work for MS Access. I've tried to add parentheses around the LEFT JOIN , but it gives me syntax error in FROM clause. So how should this query look in order to work in MS Access? 回答1: The Access DELETE requires a star (*): DELETE * FROM ...

Configure ASP.NET to use x86 on x64 Windows

对着背影说爱祢 提交于 2019-12-07 06:31:54
问题 I am trying to deploy GAL Modifier, which is an ASP.NET website which uses Microsoft Access on a Windows 2003 x64 machine. However there is no JET driver on x64 (see here), so the change is to use change the target CPU to x86. However as it is a web site there is no option in Visual Studio except Any CPU, so how can I change the settings to force it to use x86? 回答1: You may want to put a 1 or 0 on the end of that statement rather than "true" http://support.microsoft.com/kb/894435/en-us 回答2: