Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / April 2008



Tip: Looking for answers? Try searching our database.

Ado Recordset Update method an Status fields property

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dedalus - 21 Apr 2008 17:19 GMT
I have this situation (the example code it is in visual basic 6):

   Dim sSqlSelect As String
   dim vFields() as variant
   dim vValues() as variant
   Dim cnn    As ADODB.Connection

   On Error GoTo ErrorHandler
   ....
   Set cnn = New ADODB.Connection
   cnn1.Open aConnectionString
   Set rs = New ADODB.Recordset
   With rs
       .CursorLocation = adUseClient
       .CursorType = adOpenKeyset
       .LockType = adLockOptimistic
       .Open aSqlSelect, cnn
   End With

   vFields= Array("Field1", "Field2", "Field3", "Field4")
    vValues= Array(aValue1,aValue2, aValue3, aValue4)
   rs.update vFields,vValues
 ....

If, for example, the Field3 is a string field with size equals to 2
and aValue3 is a string with lenght 30,
the update method raise an error.
I can find the field that have fired the error?
In other words, my question it may be this: using Ado .Update method
with notation that use 2 arrays, the .Status property in Fields
collection dont is supported?
Ciao
Ralph - 21 Apr 2008 20:05 GMT
> I have this situation (the example code it is in visual basic 6):
>
[quoted text clipped - 28 lines]
> collection dont is supported?
> Ciao

How many times are you going to ask this question?

Enumerate the ADO.Connection.Errors collection to find the exact error.
Run the .Supports method to find out whether your provider/driver and cursor
settings supports this fuctionality.
I'm not sure if the Supports method 'supports' discovery on this obscure
syntax. But you might try it.

-ralph
Dedalus - 22 Apr 2008 08:23 GMT
> Enumerate the ADO.Connection.Errors collection to find the exact error.
> Run the .Supports method to find out whether your provider/driver and cursor
[quoted text clipped - 3 lines]
>
> -ralph

"The ADO.Connection.Errors collection to find the exact error" not
resolve my question. This collection contain the error "Multiple-step
operation generated errors. Check each status value.", but as I write
above, the .staus property in Fields collection not show any
information (status = 0 ever).
Dedalus - 22 Apr 2008 08:29 GMT
> > Enumerate the ADO.Connection.Errors collection to find the exact error.
> > Run the .Supports method to find out whether your provider/driver and cursor
[quoted text clipped - 9 lines]
> above, the .staus property in Fields collection not show any
> information (status = 0 ever).

I need to khnow the name of field that origin the error.
Ciao
Ralph - 22 Apr 2008 14:34 GMT
> > > Enumerate the ADO.Connection.Errors collection to find the exact error.
> > > Run the .Supports method to find out whether your provider/driver and cursor
[quoted text clipped - 12 lines]
> I need to khnow the name of field that origin the error.
> Ciao

It isn't 'resolution' as much as narrowing down the possibilities.

The *exact* error helps. Is this the only error in the collection?

That the provider doesn't support this construct is the most common factor
in failures. That's why I emphasized that you check that out first. Some
providers will allow this construct but with only limited datatype support.
For example, Longs, characters, and short strings may work, but currency,
dates, doubles, etc. may fail.

[Note: when I use the term "provider" I'm including the whole 'stack' -
provider, database engine, and the kind of database itself.]

So can I now assume that you can make a simple test work - e.g., something
with two fields and two simple values - therefore you are positive that your
provider and configuration DOES supports this construct? That still isn't
clear.

Don't forget that you are using 3-levels of indirection.
1) When you created the vValues array. All the values are converted to
variants.
2) When the Update method evaluates or converts the variants back into
datatypes. Using its best guess as to what its representation should be.
3) And finally when the constructed query is presented and parsed by the
provider.

My suggestion is to work out mutliple test cases with different datatypes
and try them out. Paying particular attention to dates and long strings.
Look for things like CDbl() returning "23,5" instead of "23.5", or strings
too long for the Field, ...

AFAIK the error will either report the field or it will not. (Again Provider
dependent) In this case it appears it does not. I do know that the construct
has problems and therefore always test before using it. (Actually I usually
avoid it unless I already have values in an array due to the architecure of
the program.)

Report back if you ever do find the exact cause. It may help others.

-ralph
Dedalus - 22 Apr 2008 15:06 GMT
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.