Delphi 7: ADO, need basic coding example

@mawg, i wrote an simple program for you to ilustrate how work with ADO and Delphi. this is an console application, but explains the basics. before you execute this code you must download and install the odbc connector from this location. You can improve and adapt this code to your requirements. program ProjectMysqlADO; {$APPTYPE CONSOLE} … Read more

Read and write to an access database using Javascript

First, make sure that ‘/\’ and ‘\’ (in connection string) is just a typo in SO. Second, here is a version of Delete command: function DeleteRecord() { var adoConn = new ActiveXObject(“ADODB.Connection”); var adoCmd = new ActiveXObject(“ADODB.Command”); adoConn.Open(“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=”\\dbName.mdb””); adoCmd.ActiveConnection = adoConn; adoCmd.CommandText = “Delete * From tblName Where FieldName=”Quentin””; adoCmd.Execute(); adoConn.Close(); } And, Edit … Read more

Exporting MS Access Forms and Class / Modules Recursively to text files?

You can also try this code. It will preserve the items’ filetypes (.bas, .cls, .frm) Remember to refer to / Check the Microsoft Visual Basic For Applications Extensibility Library in VBE > Tools > References Public Sub ExportAllCode() Dim c As VBComponent Dim Sfx As String For Each c In Application.VBE.VBProjects(1).VBComponents Select Case c.Type Case … Read more

How to deploy SQL Server Compact Edition 4.0?

i’ve created the solution. SQL Server Compact Edition is comprised of 7 dlls: sqlceme40.dll The undocumented, native, flat API library (The .net System.Data.SqlServerCe.dll assembly is a wrapper around this dll) sqlceca40.dll A COM dll that implements Engine, Replication, Error and a few other COM objects sqlceoledb40.dll A COM dll that implements an OLEdb provider for … Read more

Selecting 2 tables from 2 different databases (ACCESS)

You can use IN: SELECT t1.*, t2.* FROM T1 INNER JOIN (SELECT * FROM atable IN ‘C:\Docs\DB2.mdb’) t2 ON t1.ID=t2.ID EDIT: sc = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\docs\other.mdb” cn.open sc s=”SELECT * FROM t1 INNER JOIN ” _ & “[MS Access;PWD=databasePWD;DATABASE=C:\docs\db.mdb].t2 ON t1.ID=t2.ID” rs.Open s, cn EDIT 2: You can use the aliases to identify which database a … Read more

Is there a way to retrieve the view definition from a SQL Server using plain ADO?

Which version of SQL Server? For SQL Server 2005 and later, you can obtain the SQL script used to create the view like this: select definition from sys.objects o join sys.sql_modules m on m.object_id = o.object_id where o.object_id = object_id( ‘dbo.MyView’) and o.type=”V” This returns a single row containing the script used to create/alter the … Read more

Parameterized query in Classic Asp

In my code, this is how I get a recordset from a command: Set rs = server.createobject(“ADODB.Recordset”) Set cmd = server.createobject(“ADODB.Command”) cmd.ActiveConnection = Conn //connection object already created cmd.CommandText = “SELECT * FROM lbr_catmaster where catname = ?” cmd.CommandType = adCmdText cmd.CommandTimeout = 900 set prm = cmd.CreateParameter(“@prm”, 200, 1, 200, “development”) cmd.Parameters.Append prm ‘ … Read more