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 anos atrás
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 anos atrás
"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 anos atrás
 
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 anos atrás
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?
1 ano atrás
Thank you So much It's worked!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.