I have created a data adapter (CheckVacationHrsDataAdapter1) and generated a dataset (CheckHrsVacDataSet1) in the form designer. What I would like to do is query this dataset, find the sum of TotalVacationHrs per EmployeeID, and put this sum in a text box. How do I load my dataset at runtime in order to query it? Here is my query...please help
"SELECT SUM(TotalVacationHrs
FROM PYCheckHistor
WHERE (Employee = '" & EmployeeID & "')
My data adapter is mapped to the table PYCheckHistory 8 4180
Hi JC,
VacHrsThisYr.Text =
CheckHrsVacDataSet1.Tables("PYCheckHistory").Compu te("Sum(TotalVacationHrs)"
, "Employee = 'ARBUCKLEP'").toString
With other names of course, does work for me
No name problems or case sensitive problems (This kind of statements is case
sensetive)
Cor
Hi JC,
I tried it with this sample, can you try it also, the value is 1200
I hope it is with you the same?
Cor
\\\
Dim dt As New DataTable
Dim dc As New DataColumn("OHM")
dc.DataType = GetType(System.Int32)
Dim dd As New DataColumn("OHH")
dd.DataType = GetType(System.Int32)
dt.Columns.Add(dc)
dt.Columns.Add(dd)
For i As Integer = 0 To 11
dt.Rows.Add(dt.NewRow)
dt.Rows(i)(0) = 100
dt.Rows(i)(1) = 1
Next
Me.TextBox1.Text = dt.Compute("Sum(OHM)", _
"OHH = 1").ToString
///
Cor, could it be that my datatable is not populated with the dataset??
JC
That you can test with by instance
messagebox.show(CheckHrsVacDataSet1.Tables("PYChec kHistory").rows.count.tost
ring)
Cor
Hi JC,
If you have created a dataadapter using the designer and generated the
dataset with that, than you need only that fill with the right dataadapter
and datasetname (strong one)
I give it with a non strongly typed dataset also, however than your program
becomes fast a mesh. This should be enough when you made all with the
designer.
dap1.Fill(das1) ' the names you where using
VacHrsThisYr.Text = das1.Compute("Sum(TotalVacationHrs)", "Employee =
'ARBUCKLEP'").ToString
However when you first want to try from the outside
Dim cnn1 As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;
Data Source=J:\TCMW\Database\TCMW.mdb")
Dim dap1 As New OleDb.OleDbDataAdapter("SELECT Employee, CheckDate,
TotalVacationHrs from PYCheckHistory", cnn1)
Dim das1 As New DataSet
dap1.Fill(das1)
MessageBox.ShowRows.Count.ToString)
VacHrsThisYr.Text =(das1.Tables(0).Compute("Sum(TotalVacationHrs)",
"Employee = 'ARBUCKLEP'").ToString
I thought that this should work ( I typed it in here in this message and
mostly I make than typos)
Cor
Hi JC,
Do you mean something as?
VacHrsThisYr.Text = myTable.Compute("Sum(TotalVacationHrs)", "((EMPLOYEE =
'" & "EmployeeID') AND (CheckDate >" & " 'DateOfHire'))").ToString
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dan Koster |
last post by:
I have three weeks of history for all user accounts stored in a DataSet (dsAccountsHistory). I want to be able to narrow that data down to one specific user, at runtime, without having to make...
|
by: C. Hughes |
last post by:
I have a simple application that uses an XML file to store it's data. That
means I don't have a seperate database. In order to read the data I created a
DataSet that reads my XML file with the...
|
by: Abhishek Srivastava |
last post by:
Hello All,
Suppose if I have a SQL query like
select p.ID, p.NAME, p.UNIT_PRICE, o.QUANTITY from PRODUCT p ORDERS o
where p.ID = X AND P.ID = O.ID
Here one product can have many orders....
|
by: MDB |
last post by:
I'd normally Google for a question like this, and hope to snag a few
examples along with the answer, but this time I can't see to get the
keywords specific enough.
Or I'd ask coworkers, but...
|
by: Michel Moreno |
last post by:
Hi everybody, i would like to query the Index Catalog, for a site, as
describe in the article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;820105
But i'm having an error, I don't know...
| |
by: Fred |
last post by:
I want to use a dataset so that I can obtain data from a number of sources
and put it into one table. Using dataadaptors this seems to work well.
Now I have a table (Forecast) in the dataset with...
|
by: sharmaajay |
last post by:
hi all,
i want to know whether we can make a dataextract function in global
page(global.asax) though a query and.. then for each individual .aspx
page can we query tht dataset instead of creating...
|
by: sql_er |
last post by:
Guys,
I have an XML file which is 233MB in size. It was created by loading 6
tables from an sql server database into a dataset object and then
writing out the contents from this dataset into an...
|
by: Peter Savas |
last post by:
I am new to programming in C#, but have been a VB coder for 16 years,
and am facing a problem which I could use some help with:
I have an XML file which I am reading into a C# DataSet object with...
|
by: Steven Cheng [MSFT] |
last post by:
Hi Cj,
I also noticed that the "Act" variable here seems hasn't been declared(or
declared anywhere else?). I've try building the same code and got the same
result and the "Operator '+' cannot be...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |