ASP.NET, SQL Server, And Many-To-Many DB Relations

Results 1 to 2 of 2

Thread: ASP.NET, SQL Server, And Many-To-Many DB Relations

  1. #1
    Join Date
    Dec 1969

    Default ASP.NET, SQL Server, And Many-To-Many DB Relations

    Hey all, I&#039;m new to the scene and I&#039;ve been enjoying the articles on 4guys. I have a problem I&#039;m hoping I can get some help with.<BR>The background on it is as follows.<BR>Using ASP.NET, with VB not C#.<BR>I&#039;ve got a database setup with multiple tables.<BR><BR>The tables in question are: <BR> tbl_Listings<BR> ListingID<BR><BR> tbl_ListingKeys<BR> ListingID<BR> UserID<BR> PropertyTypeID<BR><BR> tbl_Users<BR> UserID<BR><BR> tbl_UserKeys<BR> UserID<BR> CompanyID<BR><BR> tbl_Companys<BR> CompanyID<BR><BR> tbl_Images<BR> ImageID<BR><BR> tbl_ImageKeys<BR> ImageID<BR> ListingID<BR><BR>What I need to do is list some things from each of those in a DataGrid like manner. BUT, in the images table there can be up to six images for one Listing, then there also could be none at all. So if I create a Select with all that in there, it&#039;ll repeat for each Image found, or it wont show at all because an Image isn&#039;t found so it can&#039;t say, tbl_ImageKeys.ImageID = tbl_Images.ImageID.<BR><BR>Am I making any sense? I&#039;m sorry if I&#039;m not, just yell and I&#039;ll try to explain it in more/less detail.<BR><BR>I&#039;m so new to this, can you tell?<BR><BR>I didn&#039;t know if I&#039;d have to have two queries, or could it be done with one &#039;indepth&#039; stored procedure.<BR><BR>Let me know what ya&#039;ll think.<BR><BR>Thanks SO much!

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP.NET, SQL Server, And Many-To-Many DB Relat

    Well, what columns are you specifically trying to get into the datagrid? <BR><BR>Certainly it sounds like a LEFT JOIN and a DISTINCT might solve the issue that you&#039;re having initally, but I don&#039;t know that that&#039;s going to be the best thing. <BR><BR>Knowing what the keys are is very helpful, but how about a little more about the data that you&#039;re trying to display...Where it&#039;s going to come from, and the rules that determine whether or no it should be shown?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts