This topic is locked

CustomQuery and Multiple Connections

11/17/2016 3:55:25 PM
ASPRunner.NET General questions
H
hgoodric author

In the application that I built, my first connection was to a MySQL database on the same server as the IIS.
Later I added a connection to read data from a SQL Server database on another server.
When I use .CustomQuery in C#, it uses the MySQL driver by default probably because it was my first connection.
In my application, it errors out, telling me that the MySQL driver cant understand the SQL server SQL statement, even though my SQL server SQL is correct.
I take it there is a hard relationship between tDAL and the first connection?
Is there a way to use CustomQuery with my second connection?
Thnx
Harold G

H
hgoodric author 11/18/2016

Well,...
the example from the manual for multiple connections doesnt use customquery. Matter of fact, it seems that the customquery method is not part of the multiple connection class hierarchy.
From the Manual:

CustomQuery documentation: https://xlinesoft.com/asprunnernet/docs/customquery.htm

string sql = "select count(*) as c from carsmodels group by make";
XVar rs = tDAL.CustomQuery(sql);
Multiple connection Documentation: https://xlinesoft.com/asprunnernet/docs/using_dal_with_multiple_database_connections.htm
var rs = GlobalVars.dal.Table("carscars","","cars at localhost").QueryAll();
.CustomQuery is a method of the tDAL Object which seems to be associated with the first connection established.
You notice the connection parameter "cars at localhost" is in a different class hierarchy GlobalVars.dal.Table.

GlobalVars.dal.Table does not implement the CustomQuery class as coding
GlobalVars.dal.Table("carscars","","cars at localhost").CustomQuery(sql)
produces a complilation error stating that.
So, either GlobalVars.dal("carscars","","cars at localhost").CustomQuery(sql) must be an impemented method or else CustomQuery is only implemented in the default DAL object tDAL which assocaited with the first connection.
Is GlobalVars.dal("carscars","","cars at localhost").CustomQuery(sql) valid?
Thnx
Harold G