jet

DEFAULT clause in ALTER TABLE statement resulting in syntax error

十年热恋 提交于 2019-12-06 13:38:55
I have a customer who would like a customization to an old, Visual Basic 5 application which uses an Access 97 database and Jet 3.5 as the database engine. The desired customization requires a column to be added to an existing table. The following works fine: strSQL = "ALTER TABLE Users ADD COLUMN Status BYTE" pdbDatabase.Execute strSQL However, I would like to set a default value (i.e. either 0 or 1) for the new column. I have tried the following and a number of variations: strSQL = "ALTER TABLE Users ADD COLUMN Status BYTE DEFAULT 1" But they all result in an error stating, "Syntax error in

Copy one access database into another database with C#

故事扮演 提交于 2019-12-06 12:30:40
Is it possible to copy programmatically all the tables in one database into another database that might already contain tables (and if there is any repeated name throw an exception of course)? This implies creating the tables in the destination database with the proper structures and with the same name as on the source database. I found a few similar questions but none of them have this particular need. I'm using the Jet engine. Found a solution: string query = "SELECT * INTO [dest_table] FROM [source_table] IN '" + sourceDataBaseFileName + "'"; using (OleDbCommand sqlCeCommand = new

What's the difference between Jet OLEDB:Transaction Commit Mode and Jet OLEDB:User Commit Sync?

心已入冬 提交于 2019-12-06 11:24:31
Althoug both Jet/OLE DB parameters are relativly well documented I fail to understand the difference between these two connection parameters: The first one: Jet OLEDB:Transaction Commit Mode (DBPROP_JETOLEDB_TXNCOMMITMODE) Indicates whether Jet writes data to disk synchronously or asynchronously when a transaction is committed. The second one: Jet OLEDB:User Commit Sync (DBPROP_JETOLEDB_USERCOMMITSYNC) Indicates whether changes that were made in transactions are written in synchronous or asynchronous mode. What's the difference? When to use which? This is very long, so here's the short answer:

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

不问归期 提交于 2019-12-05 19:01:20
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 using an ODBC provider and a MSDASQL provider with no luck as they seem to throw the same exceptions as

Multiple LEFT JOIN in Access

我怕爱的太早我们不能终老 提交于 2019-12-05 14:32:11
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? The Access DELETE requires a star (*): DELETE * FROM ... In addition, the joins must be nested by using parentheses: DELETE test1.*, test2.*, test3.*, test4.* FROM (

Configure ASP.NET to use x86 on x64 Windows

痞子三分冷 提交于 2019-12-05 08:30:18
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? 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 You should make the application pool 32 bit. Go to Application Pools in IIS7 Management Console, right click

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

こ雲淡風輕ζ 提交于 2019-12-05 05:50:12
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 Chtiwi Malek 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 Redistributable http://www.microsoft.com/download/en/details.aspx?id=13255 also you'll need to change the

MDB access using php

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 20:24:51
I am having a little bit of trouble trying to write to a .mdb database from php. The database has a table called comments and it has 3 columns "id", "comment" and "by". The code I have is this. <?php $count =0; $db_path = "newsBlog.mdb"; $odbc_con = new COM("ADODB.Connection"); $constr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $db_path . ";"; $odbc_con -> open($constr); $sql = "INSERT INTO [comments] VALUES (".$_POST['newsId'].",'".$_POST['comment']."', '".$_POST['by']."')"; echo $sql; $odbc_con -> execute (sql); $rs = null; $conn = null; echo "done"; ?> It takes 3 values from a

Microsoft JET SQL Query Logging or “How do I debug my customer's program?”

南楼画角 提交于 2019-12-04 14:04:58
The problem: We use a program written by our biggest customer to receive orders, book tranports and do other order-related stuff. We have no other chance but to use the program and the customer is very unsupportive when it comes to problems with their program. We just have to live with the program. Now this program is most of the time extremely slow when using it with two or more user so I tried to look behind the curtain and find the source of the problem. Some points about the program I found out so far: It's written in VB 6.0 It uses a password-protected Access-DB (Access 2000 MDB) that is

@@IDENTITY after INSERT statement always returns 0

与世无争的帅哥 提交于 2019-12-04 00:23:04
问题 I need a function which executes an INSERT statement on a database and returns the Auto_Increment primary key. I have the following C# code but, while the INSERT statement works fine (I can see the record in the database, the PK is generated correctly and rows == 1), the id value is always 0. Any ideas on what might be going wrong? public int ExecuteInsertStatement(string statement) { InitializeAndOpenConnection(); int id = -1; IDbCommand cmdInsert = connection.CreateCommand(); cmdInsert