This project is read-only.

mdo:sql with connectionstring

Apr 6, 2011 at 10:07 AM


Is there an example on using mdo:sql with a connectionstring?

there is the XsltDb Database Access Concepts page but example is not working on a 5.6.2 install with 2.0.66 And it to complicated for my setup. Because i'm site the only site owner and i don't want to include 2 or 3 big databases in the dotnetnuke core database.



Apr 20, 2011 at 3:22 PM


I don't think this is possible: mdo:sql only talks with DNN database, afaik.

However, it is simple to add a custom function and let it talk with any db, for example:

string cs = ConfigurationManager.ConnectionStrings["mydb"].ConnectionString;
SqlConnection conn = new SqlConnection(cs);
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = String.Format("update table set field1=1 where id=2");

Just add your connectionstring to web.config.

Apr 26, 2011 at 11:29 AM

I've come up with the following work arround. I will create SP's and Views in the Dotnetnuke Database that will call the other database. Because i don't want to program a lot of c# for simple sql selects in the presentation layer.