Visual Web Developer 2008Discuss creating ASP.NET 3.5 sites with Microsoft's Visual Web Developer 2008. If your question is more specific to a piece of code than the Visual tool, see the ASP.NET 3.5 forums instead. If your question is specific to the "Express Edition" be sure to state that in your post.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2008 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .

On my website I have a DataList that displays this. By adding "(DBProducer.ProducerID = 1)" to the WHERE command, I only display the first line (John). If I don't add this, the site displays all the information twice, with John as producer in the first set and Adam as the producer in the second. What I want to do is the DataList to display both John and Adam together in one set, and not display the same information twice with different producers, so that in my aspx file the code should look something like this:

class Program
{
static void Main()
{
//
// First, the program accesses the connection string and uses it on a connection.
//
string conString = ConsoleApplication1.Properties.Settings.Default.Co nnectionString;
using (SqlConnection connection = new SqlConnection(conString))
{
connection.Open();
//
// The SqlCommand should be created inside a using statement.
// ... It receives the SQL statement as the first argument.
// ... It receives the connection object as the second argument.
// ... The SQL text only works with a specific database.
//
using (SqlCommand command = new SqlCommand(
"SELECT TOP 3 * FROM Dogs1 ORDER BY Weight",
connection))
{
//
// Instance methods can be used on the SqlCommand instance.
// ... These read data from executing the command.
//
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
{
Console.WriteLine(reader.GetValue(i));
}
Console.WriteLine();
}
}
}
}
}
}

If it was me and I had an album with multiple producers I would create a table called Producers. Then I would have an intermediary table with an ID column, then one for AlbumID and one for ProducerID called AlbumProducers.

Then when I wanted to query info on one album I could grab all the producers at one time and not have the excessive rows for albums that is repeating the same information.