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 

SQLConfigDatasource with username and password

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





PostPosted: Wed Mar 22, 2006 6:03 pm    Post subject: SQLConfigDatasource with username and password Reply with quote



I am trying to use Delphi to create a DSN programatically using the
SQLConfigDatasource function and that seems to work fine.

However when I try to create a DSN using a specific user name and
password it does not work.

Is there a way to create a DSN with a user name and Password?

What I am trying to achieve is to connect to a database using a
particular user name and password that has rights to update data and
since this application can be run by many different client computers I
want to avoid setting up the ODBC manually for all the client
computers. I am using TADOConnection if there is any other way to
achive this task without having to mess around with all the client
computers that is welcome.

Here is the sample code that I am using

Any help in this regard will be greatly appreciated.
Thanks

procedure ADDDSN;
const
ODBC_ADD_SYS_DSN=4 ; //for system DSN
var
str1: PChar;
str: string;
begin
//Creates A DSN in the ODBC if it does not exist
str:='DSN=TEST'+#0;
str:=str+'Description=TESTING'+#0;
str:=str+'Server=SQLMACC1P\SQLMACC0P'+#0;
str:=str+'Trusted_Connection=YES'+#0;
// str:=str+'UID=xxx'+#0; DOES NOT WORK WHEN I ACTIVATE THESE TWO
LINES
// str:=str+'PWD=abc'+#0;
str:=str+'Database=XYZ'+#0;
str1 := PCHAR(str);
SQLConfigDataSource( HWnd(nil),ODBC_ADD_SYS_DSN, 'SQL Server', Str1
);
end;
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.