Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I select user information with multiple databases using ASP & VB.NET?
    primarykey
    data
    text
    <p>Okay here it goes . . . I have a web application I am developing in Microsoft Visual Web Developer using ASP, VB.net, etc. that will allow "Sellers" to post ads for "Buyers" to view. When the Buyer searches for a product, each result needs to display the Seller's name, and the product's information. The problem being that the table that holds the various product information is located in one database and the user/membership information is stored in another database. </p> <p>I'll provide an example. In this case the Buyer is searching for all ads for a particular book. </p> <ol> <li>Each ad is recorded in database db_1 and table [Results] with columns for ID_USER, and ID_BOOK.</li> <li>Book information is stored in db_1 [Books] with columns for ID, TITLE, AUTHOR.</li> <li>User information is stored in a separate database db_2 and table [Users] with columns for ID and NAME.</li> </ol> <p>Given that, how would I do something like the following:</p> <hr> <pre><code>SELECT u.Name [Seller] , b.Title [Title] , b.Author [Author] FROM db_1.Results r INNER JOIN db_1.Books b ON b.id = r.id_book INNER JOIN db_2.Users u ON u.id = r.id_user WHERE b.Title like 'Some Book Title' </code></pre> <hr> <p>If these tables were in the same database (which I'm now wishing I had done), then I would easily run an inner join or some other select statement to pull only the relevant data. I've also considered creating datasets and joining them (e.g., <a href="http://www.vb-helper.com/howto_net_dataset_foreign_key.html" rel="nofollow">http://www.vb-helper.com/howto_net_dataset_foreign_key.html</a>), but wouldn't that be way too server-heavy?</p> <p>I'm half decent with SQL statements, but all my knowledge comes from Google and from practice so if I am ignoring some crucial caveat that every classically trained programmer is aware of, I apologize. Thank you in advance for the help.</p> <p>UPDATE: I thought I would give an update on the situation. The problem actually did not have anything to do with the permissions. The problem was that VWD could not find the object. I solved this issue by using a CROSS JOIN and explicitly stating the directory path of the .mdf file in the select statement. Thank you again for all your help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload