I have two databases now. One is nopCommerce's database, another is mine. Because I have some special tables and it is used by another website. How c

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
3 года назад
I have two databases now. One is nopCommerce's database, another is mine. Because I have some special tables and it is used by another website. How can to  connect another database In nopcommerce 4.3 Please Help !
3 года назад
"connect" in what way?  If you want to access/query the other DB from inside nopCommerce code, you will need to use SQL.   Is the other DB in the same SQL Server instance?

You may be able to inject INopDataProvider dataProvider, and then
_dataProvider.Query<YourClass>(sql, sqlParams)
3 года назад
 
private readonly IRepository<MemberAccount> _memberAccountRepository;


var query = from c in _memberAccountRepository.Table
                        orderby c.DisplayOrder
                        where c.Published &&
                        !c.Deleted
                        select c;
        



A member account is a table which is in another database
And when i excute the result it's show me the error
"Invalid Object Name"..
3 года назад
It's because "a table which is in another database" is not in the same db context.  Can you create a View in your nopCommerce database that refers to table in the other database?
2 года назад
Thank you So much It's worked!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.