I'm using C# and SQL server 2005 express as the database.
I need the order displayed in the gridView to be as it is in the sql code ie:
Customers.Companyname must appear as the first column and
Suppliers.SupplierName after the column UnitPriceExVat.
But at the moment both of these columns are appearing as the last two columns in the gridView.
How can I rectify this?
This is the SQL:
sql
SELECT Customers.CompanyName, Orders.Qty,
Orders.OrderDescription,
Orders.UnitPriceExVAT, Suppliers.SupplierName,
Orders.OrderDate, Orders.Action, Orders.Printer,
Orders.ETA_Printer, Orders.Courier,
Orders.RequiredDate, Orders.Invoiced
FROM Orders INNER JOIN
Suppliers ON Orders.SupplierID = Suppliers.SupplierID INNER JOIN
Customers ON Orders.CustomerID = Customers.CustomerID
WHERE (Orders.Invoiced = @paramBool)
ORDER BY Customers.CompanyName DESC
In my Form1:
csharp
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace AgeAfrica
{
public partial class Form1 : Form
{
//private field called order, and property for it
private BusinessLogicLayer.OrdersBLL order = null;
protected BusinessLogicLayer.OrdersBLL NewOrder
{
get
{
if (order == null)
{
order = new BusinessLogicLayer.OrdersBLL();
}
return order;
}
}
public Form1()
{
InitializeComponent();
//get orders already invoiced, display in gridview
gridView1.DataSource = NewOrder.getOrdersByInvoiced(true);
}
}
}