mercoledì, febbraio 23, 2005
Using BDP to interface an Access Database
I'm writing and ASP.NET application using Delphi 2005. I'd like to test the BDP Data interface. So I create an Access Database and try to use it as backOffice DB.
I learn a lot of interesting things to insert data in Access database. I want to show the steps I followed:
1. Insert in ASP form a BDP Connection and a BDP Command
2. Configure the connection: select Database and set Admin as username (no password is required). Set Login prompt = False. (You cannot have pop up login dialog from an ASP application!!!)
3. Create the Insert Into statement using the wizard. This wizard will create automatically the set of parameters depend by selection.
4. Insert the code to: fill parameters (BDPCommand.Parameters[i].Value = value, open connection BDPCommand.Connetion.Open, Run query using BDPCommand.ExecuteNonQuery and finally close the connection (BDPCommand.Connection.Close).
I've some difficult to understand the username and password to use (in ADO.NET you can leave all blank). I receive a lot of Exceptions during my test:
1. You must use an Updateable Query: It's depend by the Access DB that was Read Only (I don't understand why!)
2. A lot of Syntax Error in SQL Query (the word note is a reserved word in Access?)
Insert a DateTime value
I've a parameter of DateTime type. To set this parameter I convert it in String format. This works fine (no #, ' to delimit the value)
I hope my experience can be useful for some other guys
That's all Folks