In my database there are few many tables, i want to join two of them.
one is Customer_Master and other is Collection
in Customer_Master table there are these following fields are available:
1.Cust_ID
2.Area_SL
3.Date
4.Cust_Name
5.Area_Code
6.Area_Name
in my Collection table
1.Cust_ID
2.Amount
3.ForMonth
4.ForYear
Now i have created an asp page form(here is the link
http://i55.tinypic.com/dwqphk.jpg[
^]) where i get an result using the above tables.
i am writing this sql query and get the above error:
if (rdbPaid.Checked)
{
da = new OleDbDataAdapter("select Customer_Master.Cust_ID, Customer_Master.Cust_Name, Customer_Master.Area_Code, Collection.Amount, Collection.ForMonth, Collection.ForYear From Customer_Master Inner Join Collection on Customer_Master.Cust_ID=Collection.Cust_ID where formonth='" + cmbMonth.Text + "' and area_name='" + cmbArea.Text + "'and foryear='"+cmbYear.Text+"'", con);
dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
lblMessage.Visible = true;
lblCustomerCount.Visible = true;
lblMessage.Text = "Total Number Of Customer is";
for (int i = 0; i <= (dt.Rows.Count - 1)+1; i++)
{
lblCustomerCount.Text = i.ToString();
}
grdMCPD.DataSource = dt;
grdMCPD.Columns[0].HeaderText = "Customer ID";
grdMCPD.Columns[1].HeaderText = "Customer Name";
grdMCPD.Columns[2].HeaderText = "Area Code";
grdMCPD.Columns[3].HeaderText = "Ammount Paid";
grdMCPD.Columns[4].HeaderText = "Month";
grdMCPD.Columns[5].HeaderText = "Year";
grdMCPD.Columns[0].Width = 150;
grdMCPD.Columns[2].Width = 100;
grdMCPD.Columns[1].Width = 100;
grdMCPD.Columns[3].Width = 100;
grdMCPD.Columns[4].Width = 75;
grdMCPD.Columns[5].Width = 40;
}
}
can anyone help to get out of this problem.
Thanks in advance.