Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 10th, 2006, 11:40 AM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid Problems

hiya.
i'v have a datagrid but i want to populate it with data from two tables, is that possible?

{
        DBAnslutning();
        strSQL = "SELECT artNr, produktNamn, farg, langd, antal, pris FROM Kundvagn WHERE Kundvagn.kundNr ='" + Session["Knr"].ToString() + "';";
        strSQL2 += "SELECT Summa, Frakt FROM FraktKostnad WHERE FraktKostnad.kundNr ='" + Session["Knr"].ToString() + "';";
        objDataAdapter = new OleDbDataAdapter(strSQL, objConnection);
        objDataAdapter = new OleDbDataAdapter(strSQL2, objConnection);
        objDataSet = new DataSet();

        objDataAdapter.Fill(objDataSet, "Kundkorg");

        dgLista.DataSource = objDataSet;

        dgLista.DataBind();

        objConnection.Close();


        return objDataSet;

}
thus far it doesent work?

plz help.


 
Old January 10th, 2006, 03:46 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You have to fill 2 tables using your 2 adapters. You should have some kind of join condition to relate the data properly.. Using one select.

Jim

 
Old January 10th, 2006, 04:01 PM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thx for your answere.

but how will i do that?

I am very new to all of this.

 
Old January 10th, 2006, 05:41 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

objDataAdapter.Fill(objDataSet, "Kundkorg");
objDataAdapter2.Fill(objDataSet, "Table2");








Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid performance problems GS C# 2005 1 April 18th, 2007 03:05 AM
problems with multiple parameters and datagrid gobotsoup General .NET 0 February 16th, 2007 05:08 PM
Problems with datagrid (plizzz help) Muzzy ASP.NET 1.0 and 1.1 Basics 8 September 26th, 2006 04:29 PM
Problems using collection with datagrid i9796674 C# 1 August 8th, 2005 08:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.