BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delphi - sql server tutorial

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
TheMaxx
Guest





PostPosted: Thu Apr 05, 2007 7:23 pm    Post subject: Delphi - sql server tutorial Reply with quote



Where can i find tutorial for Delphi connectiong to SqlServer?

Thanx.
Back to top
Alain Quesnel
Guest





PostPosted: Fri Apr 06, 2007 7:40 am    Post subject: Re: Delphi - sql server tutorial Reply with quote



If all you need is setting up the connection, it's pretty straightforward.
1) Drop a TADOConnection on your TForm or TDataModule.
2) Click on the ConnectionString property
3) Follow the wizard. For the driver type for MSSQL 7 or 2000, use OLE DB
Provider for MSSQL, for MSSQL 2005, use Native SQL Client.

Then, all other ADO components (TADOQuery, TADODataSet, TADOStoredProc,
etc.) will use the connection string of your TADOConnection (ex.:
ADOQuery1.Connection := ADOConnection1)

--

Alain Quesnel
alainsansspam (AT) logiquel (DOT) com

www.logiquel.com


"TheMaxx" <themaxxREMOVE (AT) net (DOT) hr> wrote in message
news:ev306l$s53$1 (AT) magcargo (DOT) vodatel.hr...
Quote:
Where can i find tutorial for Delphi connectiong to SqlServer?

Thanx.
Back to top
TheMaxx
Guest





PostPosted: Fri Apr 06, 2007 8:11 am    Post subject: Re: Delphi - sql server tutorial Reply with quote



Thanks!
I think drag-n-drop is great funcionality, however i really need to konw
what's going on
like:

ADOConn conn := new ADOConn();
conn.ConnectionString := '....';
ADORecordSet ARS := conn.ExecuteSqj('SELECT * FROM Table');

Where can i find references with examples?
I find Borlan help wery poor with no examples.
Resources on web are not that great either.

Thank you for you help!


"Alain Quesnel" <alainsansspam (AT) logiquel (DOT) com> wrote in message
news:4615b333$1 (AT) newsgroups (DOT) borland.com...
Quote:
If all you need is setting up the connection, it's pretty straightforward.
1) Drop a TADOConnection on your TForm or TDataModule.
2) Click on the ConnectionString property
3) Follow the wizard. For the driver type for MSSQL 7 or 2000, use OLE DB
Provider for MSSQL, for MSSQL 2005, use Native SQL Client.

Then, all other ADO components (TADOQuery, TADODataSet, TADOStoredProc,
etc.) will use the connection string of your TADOConnection (ex.:
ADOQuery1.Connection := ADOConnection1)

--

Alain Quesnel
alainsansspam (AT) logiquel (DOT) com

www.logiquel.com


"TheMaxx" <themaxxREMOVE (AT) net (DOT) hr> wrote in message
news:ev306l$s53$1 (AT) magcargo (DOT) vodatel.hr...
Where can i find tutorial for Delphi connectiong to SqlServer?

Thanx.


Back to top
Dennis Passmore
Guest





PostPosted: Fri Apr 06, 2007 11:41 pm    Post subject: Re: Delphi - sql server tutorial Reply with quote

function ADOConnectionString(fTrusted: Boolean;
const fUserName, fPassword, fDataBase, fSqlServer: string): string;
var
fModuleFileName: string;
begin
Result := '5098';
SetLength(fModuleFileName, 255);
GetModuleFileName(HInstance, PChar(fModuleFilename), 255);
fModuleFilename := ExtractFilename(Strpas(pchar(fModuleFilename)));
if fTrusted then
Result :=
'Application Name=' + fModuleFilename + ';' +
'Workstation ID=' + Get_Computer_Name + ';' +
'LoginName=' + Get_User_Name + ';' +
'Provider=SQLOLEDB.1;' +
'Network Library=DBMSSOCN;'+
'Use Procedure for Prepare=0;'+
'OLE DB Services=-1;' +
'Persist Security Info=True;' +
'Integrated Security=SSPI;' +
'Initial Catalog=' + fDatabase + ';' +
'Data Source=' + fSqlServer
else
Result :=
'Application Name=' + fModuleFilename + ';' +
'Workstation ID=' + Get_Computer_Name + ';' +
'LoginName=' + Get_User_Name + ';' +
'Provider=SQLOLEDB.1;' +
'OLE DB Services=-2;' +
'Persist Security Info=True;' +
'User ID=' + fUsername + ';' +
'Password=' + fPassword + ';' +
'Initial Catalog=' + fDataBase + ';' +
'Data Source=' + fSqlServer;
end;


Quote:
ADOConn conn := new ADOConn();
conn.ConnectionString := ADOConnectionString(false,
'someone','something','tempdb','someserver');
Back to top
Alain Quesnel
Guest





PostPosted: Mon Apr 09, 2007 5:09 am    Post subject: Re: Delphi - sql server tutorial Reply with quote

The connection string is merely a list of connection parameters separated by
semi-colons. Their values are self explanatory.

For a connection to a database unsing ADO (dbGo), you need:

A) A connection string. This can be centralized on a TADOConnection, or
specified for each TADOxxx component (Query, Dataset, StoredPRoc, etc.)
B) A TADOxxx component.
C) That TADOxxx component needs a connection string or a TADOConnection,
either a table name or a SQL statement (select * from MyTable) or a
procedure name (for a TADOStoredProc), parameters if need be.
D) A TDataSource
E) A TDBGrid or a few DB aware components (TDBEdit, TDBLabel, TDBMemo, etc.)

I can post (on the attachments NG) a small test project that connects to a
MSSQL table.

--

Alain Quesnel
alainsansspam (AT) logiquel (DOT) com

www.logiquel.com


"TheMaxx" <themaxxREMOVE (AT) net (DOT) hr> wrote in message
news:ev4p0f$b63$1 (AT) magcargo (DOT) vodatel.hr...
Quote:
Thanks!
I think drag-n-drop is great funcionality, however i really need to konw
what's going on
like:

ADOConn conn := new ADOConn();
conn.ConnectionString := '....';
ADORecordSet ARS := conn.ExecuteSqj('SELECT * FROM Table');

Where can i find references with examples?
I find Borlan help wery poor with no examples.
Resources on web are not that great either.

Thank you for you help!


"Alain Quesnel" <alainsansspam (AT) logiquel (DOT) com> wrote in message
news:4615b333$1 (AT) newsgroups (DOT) borland.com...
If all you need is setting up the connection, it's pretty
straightforward.
1) Drop a TADOConnection on your TForm or TDataModule.
2) Click on the ConnectionString property
3) Follow the wizard. For the driver type for MSSQL 7 or 2000, use OLE DB
Provider for MSSQL, for MSSQL 2005, use Native SQL Client.

Then, all other ADO components (TADOQuery, TADODataSet, TADOStoredProc,
etc.) will use the connection string of your TADOConnection (ex.:
ADOQuery1.Connection := ADOConnection1)

--

Alain Quesnel
alainsansspam (AT) logiquel (DOT) com

www.logiquel.com


"TheMaxx" <themaxxREMOVE (AT) net (DOT) hr> wrote in message
news:ev306l$s53$1 (AT) magcargo (DOT) vodatel.hr...
Where can i find tutorial for Delphi connectiong to SqlServer?

Thanx.




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.