Developer forum

Forum » Development » Login failed with Dw's connection string?

Login failed with Dw's connection string?


Reply

I'm trying to get the connection string out of DW, it does supply the connection strnig however i think it doesent do it correctly.

Atleast i get the error:Login failed for user XXXX.


I've triede using my own connectionString which works fine, however the code underneath fails.

 

 

 

 private void Page_Load(object sender, System.EventArgs e)
        {
            IDbConnection conn = Database.GetConn("Dynamicweb.mdb");
            SqlDataSource1.ConnectionString = conn.ConnectionString;
        }

 

 

Any suggetions?


Replies

 
Reply

The Dynamicweb database is called Dynamic.mdb. If you're using MS Access that might be the reason why you receive the error.

 
Reply

im using SQL server

 
Reply

Weird, I checked the code, all variables should be available. Are you using trusted connection?

 

I assume that everything else in Dynamicweb works?

 

Please make sure that the webform is not in it's seperate IIS application.

 

Are you able to:

 

IDataReader dr = Database.GetDataReader("SELECT * FROM Page", "Dynamic.mdb");

 

Have you tried logging on to admin and then navigation to your webform from that same window?

 
Reply
Sorensen wrote:

Weird, I checked the code, all variables should be available. Are you using trusted connection?

 

I assume that everything else in Dynamicweb works?

 

Please make sure that the webform is not in it's seperate IIS application.

 

Are you able to:

 

IDataReader dr = Database.GetDataReader("SELECT * FROM Page", "Dynamic.mdb");

 

Have you tried logging on to admin and then navigation to your webform from that same window?

Everything else works correct, and my code works if i do my connectionstring manually.

 

I add the module to my backend and it gives me the error when trying to acces it from the backend, also if i debug on the single file, in the project.

When i debug i can see i get DBA , user etc. however i do not get password out?

 
Reply

Are you able to print out these values:

 

Base.GetGs("/Globalsettings/System/Database/Database")
Base.GetGs("/Globalsettings/System/Database/SQLServer")
Base.GetGs("/Globalsettings/System/Database/UserName")
Base.GetGs("/Globalsettings/System/Database/Password")

 

They contain the information that Dynamicweb uses to connect to the database.

 
Reply

 StringBuilder sbConnectionString = new StringBuilder();
            sbConnectionString.Append("Data Source=" + Base.GetGs("/Globalsettings/System/Database/SQLServer" + ";"));
            sbConnectionString.Append("Initial Catalog=" + Base.GetGs("/Globalsettings/System/Database/Database") + ";");
            sbConnectionString.Append("User ID=" + Base.GetGs("/Globalsettings/System/Database/UserName") + ";");
            sbConnectionString.Append("pwd=" + Base.GetGs("/Globalsettings/System/Database/Password"));

 

 


            SqlDataSource1.ConnectionString = sbConnectionString.ToString();

 

It seems like that SQLServer returns empty ? :(

 
Reply

Are the GS variables empty?

 
Reply
Sorensen wrote:

Are the GS variables empty?


 

Base.GetGs("/Globalsettings/System/Database/SQLServer") , seems like its returning empty :(

 
Nicolai Høeg Pedersen
Reply
jed@dkis.dk wrote:
Sorensen wrote:

Are the GS variables empty?


 

Base.GetGs("/Globalsettings/System/Database/SQLServer") , seems like its returning empty :(


 

And what does the /Globalsettings/System/Database/SQLServer node in /Files/Globalsettings.aspx contain?

 
Reply
np wrote:
jed@dkis.dk wrote:
Sorensen wrote:

Are the GS variables empty?


 

Base.GetGs("/Globalsettings/System/Database/SQLServer") , seems like its returning empty :(


 

And what does the /Globalsettings/System/Database/SQLServer node in /Files/Globalsettings.aspx contain?


 

it contains the sqlserver adress , however i made a work around by adding my own connection string in web.config , it would just have been nice if i could have used the Connstring to get it to avoid multiple places where you have to update when if the site needs to change sql dba :)

 
Reply

Oh, ok. Maybe we should have a look at this to see, how we can make these things easier for you to work with.

 

You must be logged in to post in the forum