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 

connecting to SQL server 2000

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





PostPosted: Sun Apr 08, 2007 1:19 am    Post subject: connecting to SQL server 2000 Reply with quote



Hi,

I have installed SQL server 2000 on my windows xp. I want to use a
table of one of my databases in a delphi 7 application. I use windows
authentication to connect to SQL server. How I can write an aplication
in delphi to connect to SQL server. Delphi always prompted me for user
name and password and I do not know what to do.

In visual basic I wrote a code like:

Dim cn As New ADODB.Connection
Dim ServerName As String, cmdname As String
Dim DatabaseName As String
Dim rs As ADODB.Recordset

ServerName = "(local)"
DatabaseName = "mypatient"
cn.ConnectionTimeout = 150
cn.Provider = "sqloledb"
cn.Properties("Data Source").Value = ServerName
cn.Properties("Initial Catalog").Value = DatabaseName
cn.Properties("Integrated Security").Value = "SSPI"
cn.Open

But I do not know what to do in delphi. Any help?

Surena.
Back to top
Wayne Niddery [TeamB]
Guest





PostPosted: Sun Apr 08, 2007 2:45 am    Post subject: Re: connecting to SQL server 2000 Reply with quote



surena wrote:
Quote:

I have installed SQL server 2000 on my windows xp. I want to use a
table of one of my databases in a delphi 7 application. I use windows
authentication to connect to SQL server. How I can write an aplication
in delphi to connect to SQL server. Delphi always prompted me for user
name and password and I do not know what to do.

In visual basic I wrote a code like:

ServerName = "(local)"
DatabaseName = "mypatient"
cn.ConnectionTimeout = 150
cn.Provider = "sqloledb"
cn.Properties("Data Source").Value = ServerName
cn.Properties("Initial Catalog").Value = DatabaseName
cn.Properties("Integrated Security").Value = "SSPI"
cn.Open

But I do not know what to do in delphi. Any help?

Use the ADO components. Drop an ADOConnection component down and in the
Object Inspector click the ConnectionString property, then click the elipsis
button there. On the next dialog select "Use Connection String" and click
the Build button. Select the SQL Server OLE DB driver, and follow through
from there.

You can do this in code too if you know the required details, e.g:

ADOConnection1.ConnectionString :=
'Provider=SQLOLEDB.1;Integrated Security=SSPI;'
+ 'Persist Security Info=False;'
+ 'Initial Catalog=Northwind;Data Source=(local)';

--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"At the apex of every great tragedy of mankind there stands the figure
of an incorruptible altruist." - Ayn Rand
Back to top
Alain Quesnel
Guest





PostPosted: Mon Apr 09, 2007 5:10 am    Post subject: Re: connecting to SQL server 2000 Reply with quote



You also need to set the TADOConnection.LoginPrompt property to False.

--

Alain Quesnel
alainsansspam (AT) logiquel (DOT) com

www.logiquel.com


"Wayne Niddery [TeamB]" <wniddery (AT) chaffaci (DOT) on.ca> wrote in message
news:461810e8$1 (AT) newsgroups (DOT) borland.com...
Quote:
surena wrote:

I have installed SQL server 2000 on my windows xp. I want to use a
table of one of my databases in a delphi 7 application. I use windows
authentication to connect to SQL server. How I can write an aplication
in delphi to connect to SQL server. Delphi always prompted me for user
name and password and I do not know what to do.

In visual basic I wrote a code like:

ServerName = "(local)"
DatabaseName = "mypatient"
cn.ConnectionTimeout = 150
cn.Provider = "sqloledb"
cn.Properties("Data Source").Value = ServerName
cn.Properties("Initial Catalog").Value = DatabaseName
cn.Properties("Integrated Security").Value = "SSPI"
cn.Open

But I do not know what to do in delphi. Any help?

Use the ADO components. Drop an ADOConnection component down and in the
Object Inspector click the ConnectionString property, then click the
elipsis button there. On the next dialog select "Use Connection String"
and click the Build button. Select the SQL Server OLE DB driver, and
follow through from there.

You can do this in code too if you know the required details, e.g:

ADOConnection1.ConnectionString :=
'Provider=SQLOLEDB.1;Integrated Security=SSPI;'
+ 'Persist Security Info=False;'
+ 'Initial Catalog=Northwind;Data Source=(local)';

--
Wayne Niddery - Winwright, Inc (www.winwright.ca)
"At the apex of every great tragedy of mankind there stands the figure
of an incorruptible altruist." - Ayn Rand
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.