hello every one again
well this time i am total confuse for this
i have a table tblpay which is having 5 colums
payID
payTransID
payyear
paymonth
totalpay
now i want to show the record based on two columns i.e.:
payyear = 2012
and
payyear = march,april,may,june,july,august,sepetember,october,november,december
and also
wher payyear = 2013
and
paymonth = january,february only
it is as financial year data to be show
currently im using this code to fill DGV:

DataAdapter1 = New OleDbDataAdapter("Select * From " & txttable.Text & " where" _
                                            & "[empID] = '" & lblempID.Text & "' AND" _
                                            & "[pay_year] = '" & txt2011.Text & "' ORDER BY payID", Con)

        DataSet1.Clear()
        DataAdapter1.Fill(DataSet1, "'" & txttable.Text & "'")
        DataAdapter2.Fill(DataSet1, "'" & txttable.Text & "'")
        DGVtotalpay.DataSource = DataSet1.Tables(0)
        DGVtotalpay.Refresh()

please help me for this i will be very thankfull to you as earlier
please provide me some code which can do this job

thanks in anticipation

Recommended Answers

All 4 Replies

Does the grid have a column for each month so that all pay for a year is in one row of the grid?

payID | payYear | Jan | Feb | Mar | ....

DGVtotalpay.DataSource = DataSet1.Tables(0)

I think you need to specify the table name like Dataset1.tables(txttable.text)

1-you did not define dataadapter2 .
2-and you are fill dataset1 and same table with it.

First assign query and connection to dataadapter2 then fill dataset1 with it.

Regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.