Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / Connectivity / November 2004

Tip: Looking for answers? Try searching our database.

Problems setting DSN from csharp when

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Brockhoff - 19 Nov 2004 10:11 GMT
Hello NG,

the code below works, but if i add
the outcommented part of it (the Uid and Pwd section) the
function fails and returns false.

Why is that so? Do I have to add a addidinalt Parameter?

Regards

Michael

<CodeSchnipsel>

private bool AddSQLUserDSN(string DSName, string DBPath) {
bool ret;
     try{
           ret = SQLConfigDataSource((IntPtr)0, 1,
                 "SQL Server",
                 "DESCRIPTION="+ DSName + "\0" +
                 "DSN="+DSName+ "\0" +
                 "Server="+ this.txtbODBCServer.Text + "\0" +
                 "Database="+ DSName+ "\0");
//                "Uid="+ this.txtBODBCUser.Text + "\0" +
//                "pwd="+ this.txtBODBCPassword.Text + "\0");

           return ret;
     }catch(Exception exc){
           MessageBox.Show(exc.Message);
           return false;
     }
}
Sue Hoegemeier - 22 Nov 2004 20:24 GMT
I don't think specifying uid and pwd with
SQLConfigDataSource API is supported with SQL Server. You
can find the supported attributes for the SQL Server ODNBC
driver at:
http://msdn.microsoft.com/library/en-us/odbcsql/od_odbc_c_99yd.asp
You can specify to use a trusted connection. But as noted in
the docs, if you don't specify a trusted connection then the
User name and password must be provided for each connection.

-Sue

>Hello NG,
>
[quoted text clipped - 28 lines]
>      }
>}
Michael Brockhoff - 24 Nov 2004 09:22 GMT
Many thanks.
at least now i know why it does not work.

Regards Michael
>I don't think specifying uid and pwd with
> SQLConfigDataSource API is supported with SQL Server. You
[quoted text clipped - 39 lines]
>>      }
>>}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.