I am getting this error with my delphi code below after following this tutorial: Delphi 7: ADO, need basic coding example . I have seen other solutions however I am unsure what they really mean or what I should actually do. I was wondering if someone could see if there was an obvious problem or explain what I should be checking. Error I am getting on the ADOConnection1:=TADOConnection.create(nil) line.
[Microsoft][ODBC MANAGER] data source name not found and default driver not specfied
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,ADODB,Stdctrls, DB;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
procedure createdb;
procedure closedb;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Procedure TForm1.createdb;
var
nameDB:string;
connectionstring:string;
begin
connectionstring:='Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=E:\Project;';
namedb:='Project1db.accdb';
ADOConnection1:=TADOConnection.Create(nil);
ADOConnection1.LoginPrompt:=false;
ADOConnection1.Connected:=true;
ADOConnection1.Execute('CREATE DATABASE IF NOT EXISTS
Project1db.accdb',cmdtext);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
createdb;
closedb;
end;
Procedure TForm1.closedb;
begin
ADOConnection1.Free;
end;
end.