|
I think what you have mentioned here is pretty much what I have described but consider the following. If the start time was 09:00. And the response time was 8 hours, the time to respond by would be 17:00.
The thing is this calculation would have gone over lunch time. At which point I need to add 1 additional hour as lunch time is not counted.
DO you understand my problem here?
|
|
|
|
|
Hi Sam,
My confusion is wat the input is and wat the output should be. Could you please clarify wat you are inputting into the system (whether its start or end time, duration or lunch start and end time), also clarify wat the output u want is and we can take it from there.
Sheers
|
|
|
|
|
I have a start time, created when the job is logged. I have a response time, taken from the contract that covers the job. Therefore I have a 'time to respond to by'. Which is the logged time plus the given time span.
Therefore this final time is what my calculations are aiming towards. My issue is how do I check if my two times have gone over a lunch time or not??
|
|
|
|
|
public function getTimeWorked(ByVal StartTime as date, ByVal Duration as TimeSpan, _
ByVal EndTime as date, ByVal LunchStartTime as date, ByVal LunchDuration as TimeSpan) as TimeSpan
dim ActualTimeWorked as TimeSpan
dim TimeWorked as TimeDuration = StartTime - EndTime
if (StartTime < LunchStartTime) and (EndTime > (LunchStartTime + LunchDuration)) then
ActualTimeWorked = TimeWorked - LunchDuration
endif
return ActualTimeWorked
end if
Within the same if statement, u can modify the code to get if the guy finished work DURING lunch period and do the necessary calculations or if he started DURING the lunch period and calculate accordingly.
|
|
|
|
|
I've written the following code..
for updating the dataset....
I don't know how to update the dataset...
Can u help me the correct code..
Here is the Code...
....First Time After Executing SELECT statement...
Dim mycmd As New OleDb.OleDbCommand
Dim da As New OleDb.OleDbDataAdapter
mycmd.CommandText = qry
mycmd.Connection = conn
da.SelectCommand = mycmd
da.Fill(ds_shifts)
....Now I wanted to Update data in the Dataset...
If ds_shifts.Tables(0).Rows(0).Item(0) = -1 Then
ds_shifts.Tables(0).Rows(0).Item(1) = empid
ds_shifts.Tables(0).Rows(0).Item(2) = "w"
da.Update(ds_shifts) .... this line is giving error.
End If
Happy Day!
|
|
|
|
|
What is the Error ?
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Sorry for not giving error details...
The error is...
"System.InvalidOperationException:Update requires a valid UpdateCommand when passed DataRow collection with modified rows."
Happy Day!
|
|
|
|
|
Good morning
This means that you have no Update command specified. look at it this way. you cannot update without the UpdateCommand. for example, if you can try to create everything using a Wizard, just do the drag and drops. in your adapter's Properties there is a update Commnad. it tell the Adapter which column to update, when the update function is invoked as you Did.because you are not using a wizard of which is good, you have to write the updatecommand.
The Updatecommand will like like this.
UPDATE Employee SET Emp_ID = 0918, W = "w"
Hope it Helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Initially the SELECT Command was like this...
'----------------------------------------------'
qry = "SELECT ASSSHIFT.Day12,ASSSHIFT.EmployeeId,SHIFTDETAILS.ShiftCode,SHIFTDETAILS.tIn,
SHIFTDETAILS.tOut FROM
ASSSHIFT LEFT JOIN SHIFTDETAILS ON ASSSHIFT.Day12= SHIFTDETAILS.iId
where
ASSSHIFT.EmployeeId=94 AND
ASSSHIFT.MonthNum=10 AND
ASSSHIFT.YearNum=2007
'----------------------------------------------'
Dim mycmd As New OleDb.OleDbCommand
Dim da As New OleDb.OleDbDataAdapter
mycmd.CommandText = qry
mycmd.Connection = conn
da.SelectCommand = mycmd
da.TableMappings.Add("table0", "ASSSHIFT")
da.TableMappings.Add("table1", "SHIFTDETAILS")
ds_temp.Clear()
da.Fill(ds_temp)
This is my UpdateCommand...
uquery = "UPDATE ASSSHIFT SET day12=3 WHERE EmployeeId=94 AND MonthNum=10 AND YearNum=2007"
Dim comm As New OleDb.OleDbCommand
comm.CommandText = uquery
comm.Connection = myconn ...(Connection Opened)
comm.ExecuteNonQuery()
Now I'm writing update query....
da.Update(ds_shifts)
Now the error is ....
"Update unable to find TableMapping['Table'] or DataTable 'Table'"
Happy Day!
|
|
|
|
|
Hello,
I am trying to create a custom DataGridViewColumn,
This Column has many custom properties (perhaps, of Boolean or String type)
My question is that when i try to set value in the ColumnCollectionUITypeEditor wich open on clicking the Columns() property at design time, these properties doesn't take the new value,
I Tried a lot of methods to solve this problem, but i didn't can to do.
Please, if there is any person know what can i do, write for me the solution.
Thanks...
[Thomas]
|
|
|
|
|
Hi i am trying to find out if tables and fieldnames can start with a number in access. I am writing my Select command for my adapter and I keep getting an error sayig there is a missing operator. My sql is pasted below:
Dim value As String = DateTimePicker1.Value.Date.ToString<br />
<br />
<br />
modbcmdSelect.CommandText = ("SELECT * FROM dayScheduleTemplate,dayTemplateScheduleName, scheduleDate " & _<br />
"WHERE dayScheduleTemplate.dayTemplateScheduleName = dayTemplateScheduleName.24TemplateScheduleName and " & _<br />
"dayTemplateScheduleName.24TemplateScheduleName = scheduleDate.24TemplateScheduleName and scheduleDate.scheduleDate= #" & value & "#")
Mr oizo
|
|
|
|
|
Put brackets around the field name: dayTemplateScheduleName.[24TemplateScheduleName]
---
single minded; short sighted; long gone;
|
|
|
|
|
If possible, you'd probably have to enclose any such table and field names in square brackets:
SELECT * FROM dayScheduleTemplate,dayTemplateScheduleName, scheduleDate
WHERE dayScheduleTemplate.dayTemplateScheduleName = dayTemplateScheduleName.[24TemplateScheduleName]
and dayTemplateScheduleName.[24TemplateScheduleName] = scheduleDate.[24TemplateScheduleName] and
scheduleDate.scheduleDate
|
|
|
|
|
hi all,
i have a datagridview in my program. i add column of combo type at run time .Now my problem is that how can i detect selected index change event of this combo.
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Youre trying to treat that ComboBox like it's the same one you drop on a form. It's not. That combo is buried under a DataGridViewComboBoxCell as the cell's Edit Control, which is buried under a DataGridViewComboBoxColumn.
What do you think you need this for?? Under any normal circumstances, if your dataset/datatable, dgv is configured correctly, you would never need to handle this event.
|
|
|
|
|
use the event cellendedit.
Dim indexcombo As Integer = 0
If e.ColumnIndex = 0 Then<br />
indexcombo = CType(Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex), DataGridViewComboBoxCell).Items.IndexOf(Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString)<br />
End If<br />
valoareCombo = Me.dgvTipuriColoane.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
where the indexcombo is the index you choosed in combo.
|
|
|
|
|
That's why I asked him why he needs this. Your using an event that doesn't fire until the new value is commited to the cell. Is he looking for that?? Or is he looking to find out BEFORE the value is commited?? That's why I asked...
|
|
|
|
|
Hi everybody.
I Have two web applications that share several dll´s.
After reading about the way to avoid duplicated ocurrences of dll´s in each \bin folder of the aplications, I have decided to add the common dll´s in the GAC.
Ok it´s right, I have de dll´s in the Global Assembly Cache, but the web aplications doesn´t work.
Can anybody say me something about?, What am I doing wrong?, Is it necessary to modify something for the aplications to get access to the GAC?.
Is a matter of IIs configuration or is a programatic issue?.
Is the GAC the right way to get this sharing?.
Is there any other way to do so?.
Thanks in advance.
|
|
|
|
|
If you have an assembly being used by more than one application then yes the GAC is the way to go. u can also have multiple version of the same dll installed, something that was impossible before .net. Wat i do not understand however is wat you mean when you say the application doesn't work. Not working could be a result of many things from getting an error to getting wrong results. If you are getting an error, then wat does it say? your question in its current state is vague and almost impossible to answer. Could you please provide more information on the 'Not Working' part.
|
|
|
|
|
Ok Mbire, thanks for your answer. Sorry if I din´t write more specific details. I was not sure that could be relevant.
In a first situation I have two applications, each one with its own \bin folder containing a number of dll´s.
After adding the dll´s to the GAC, I have deleted both applications \bin folder.
Now when I try lo load the main page of one of them I receive this error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'ItemsChoiceTypeLogOn' is not defined.
Source Error:
...
Line 72: <xmlelementattribute("itemselementname"), xmlignoreattribute()=""> ByRef ItemsElementName() As ItemsChoiceTypeLogOn _
...
Source File: D:\MTscada\www\ServerTorres\App_Code\IEC61400WebService.vb Line: 72
I guess that Internet Information Server doesn´t find the adecuate dll, because if I restore the \bin folders with the dll´s inside, both applications work fine.
|
|
|
|
|
|
|
|
I have made a system which is Ordering System, I'm still a student and on Monday October 15, 2007 is my defend. My system can display datas in the listview into the textboxes on 'click' event but I want to display one single row of datas in the listview into the textboxes at form load.
here's my code:
Public Sub passToTextbox()
Try
With Me
txtCustID.Text = lstCust.SelectedItems.Item(0).Text
txtCompName.Text = lstCust.SelectedItems.Item(0).SubItems(1).Text
txtContactName.Text = lstCust.SelectedItems.Item(0).SubItems(2).Text
txtContactTitle.Text = lstCust.SelectedItems.Item(0).SubItems(3).Text
txtAddress.Text = lstCust.SelectedItems.Item(0).SubItems(4).Text
txtPostalCode.Text = lstCust.SelectedItems.Item(0).SubItems(5).Text
txtPhoneNo.Text = lstCust.SelectedItems.Item(0).SubItems(6).Text
txtFaxNo.Text = lstCust.SelectedItems.Item(0).SubItems(7).Text
End With
Catch ex As Exception
MsgBox("Establishing database connection...", vbOKOnly, "System")
MsgBox("Fetching database records...", vbOKOnly, "System")
End Try
End Sub
Private Sub lstCust_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstCust.MouseClick
passToTextbox()
End Sub
Private Sub frmCustomer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
oCustFacade.loadToList(lstCust)
passToTexbox()
LockUnlock(2)
ButtonCtrl(3)
lstCust.FullRowSelect = True
End Sub
>>>>>> hope for a reply as soon as possible
>>>>>> may GOD bless us...
|
|
|
|
|
I'm not sure what the problem is but I'm guessing the load doesn't work.
At first sight I'd say you forgot to select a row in the load before you call the function passtottextbox (since this function uses the selecteditems property you must have at least 1 selected for it to work)
try something like this (not real code)
Private Sub frmCustomer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
oCustFacade.loadToList(lstCust)
lstcust.selectedrow = 1
'or
lstcust.items(0).select
passToTexbox()
LockUnlock(2)
ButtonCtrl(3)
lstCust.FullRowSelect = True
End Sub
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|