FW: [U2] Uniobjects.net READU Question

2007-03-01 Thread IT-Laure Hansen
Please read the thread below: Chuck in our staff has interesting
comments and some workaround coding methodology that may be the answer.

Laure Hansen,
City of Redwood City
Information Technology
www.redwoodcity.org
1017 Middlefield Road
Redwood City, CA 94063
Tel: 650-780-7087
Fax: 650-556-9204
[EMAIL PROTECTED]
 


-Original Message-
From: IT-Chuck Smith 
Sent: Thursday, March 01, 2007 1:27 PM
To: IT-Laure Hansen
Subject: RE: [U2] Uniobjects.net READU Question


The pre dot.net uniobjects did not have exceptions (more accurately, the
pre dot.net VB did not have exceptions) so you had to check the status.
I continued the practice in my dot net app partly out of habit but  also
because I read the documentation and saw that the status tests were
still supported.  I agree that it looks like there is a bug, but if the
code is robust you won't hit it.  You can send my sample in as a
workaround if you want -- it's definitely the way to go.

Chuck 

-Original Message-
From: IT-Laure Hansen 
Sent: Thursday, March 01, 2007 1:24 PM
To: IT-Chuck Smith
Subject: RE: [U2] Uniobjects.net READU Question

Thanks, I'll try to look into your code further soon. Do you recommend I
send it back to the U2 e-mail group as a workaround? I'll be happy to do
that. 

I'm surprised you haven't hit it in your work in the past (unless there
were no records locks in the code you've written in the past?). Seems
that if it is a known bug, it would have surfaced pretty quickly. Maybe
it is linked to a specific version and/or environment?

Laure Hansen,
City of Redwood City
Information Technology
www.redwoodcity.org
1017 Middlefield Road
Redwood City, CA 94063
Tel: 650-780-7087
Fax: 650-556-9204
[EMAIL PROTECTED]
 


-Original Message-
From: IT-Chuck Smith 
Sent: Thursday, March 01, 2007 1:19 PM
To: IT-Laure Hansen
Subject: RE: [U2] Uniobjects.net READU Question


No I didn't know about it.  In addition to catching the exception, we
should test the status.  This covers the bases.  Here is what I mean
from my demo app (the test for UVE_RNF is for a record that doesn't
exist, i.e. Record Not Found):

Try
Form5020.RecordID = ClaimNo.Trim
Form5020.Read()
Select Case Form5020.FileStatus
Case UVE_NOERROR
If Form5020.Record.Extract(30, 0, 0).StringValue
= "" Then
Call EnableFields(True)
Else
txtApprDate.Text =
UniverseConnection.uonetSession.Oconv(Form5020.Record.Extract(30, 0,
0).StringValue, "D4/")
Call EnableFields(False)
End If
txtEmp5020.Text = ClaimNo.Trim
txtInj5020.Text = ClaimNo.Trim
txtAppr5020.Text = ClaimNo.Trim
temp = Form5020.Record.Extract(1, 1,
0).StringValue
Call GetEmployeeData(temp)
txtEmpSsn.Text = temp.Substring(0, 3) + "-" +
temp.Substring(3, 2) _
+ "-" + temp.Substring(5, 4)
temp =
UniverseConnection.uonetSession.Oconv(Form5020.Record.Extract(14, 0,
0).StringValue, "D4/")
dte = Convert.ToDateTime(temp).ToLongDateString
dteInjuryDate.Value = dte
txtAccidentDesc.Text =
Form5020.Record.Extract(10, 0, 0).StringValue
cnt = InjuryCodes.Dcount(1)
For i = 1 To cnt
If Form5020.Record.Extract(58, 0,
0).StringValue = InjuryCodes.Extract(1, i, 0).StringValue Then
cmbKindOfAccident.SelectedIndex = i - 1
Exit For
End If
Next
txtSupvName.Text = Form5020.Record.Extract(28,
0, 0).StringValue
temp =
UniverseConnection.uonetSession.Oconv(Form5020.Record.Extract(30, 0,
0).StringValue, "D4/")
If temp.Trim <> "" Then
dte =
Convert.ToDateTime(temp).ToLongDateString
txtApprDate.Text = dte.ToString
End If
If txtApprDate.Text <> "" Then
btnApprove.Enabled = False
End If
tab5020.SelectedTab = EmployeeTab
Case UVE_RNF
ok = MessageBox.Show("Claim " + ClaimNo.Trim + "
Not Found.", _
"Simple 5020", buttonType, icontype, 0, 0)
Exit Sub
Case UVE_LCK Or UniObjectsTokens.LOCK_OTHER_READU
   

[U2] Uniobjects.net READU Question

2007-03-01 Thread Patricia Wilson
Issue: When you do a READU on a record that doesn't exist, the first
time it fails and hits the exception, but the second read is successful
- even though the record still doesn't exist.



Why? Is this a bug?

   try

{

UniSession u=UniObjects.OpenSession("host", "login",
"passwd", "account", "uvcs");

UniFile file=u.CreateUniFile("filename");

file.UniFileLockStrategy =
UniObjectsTokens.UVT_EXCLUSIVE_READ;

UniDynArray record;

for (int i = 0; i < 2; i++)

{

try

{

record = file.Read("reckey");

txtStatus.Text += string.Format("Try#{0}: read
successful\r\n", i);

}

catch (Exception ex)

{

txtStatus.Text += string.Format("Try#{0}: read
exception: {1}\r\n", i, ex.Message);

}

}

UniObjects.CloseSession(u);

}

catch (Exception ex)

{

txtStatus.Text += string.Format("session exception:
{0}\r\n", ex.Message);

}













Patricia M. Wilson

MIS

x 3095

813.635.3095

[EMAIL PROTECTED]
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/