Le mardi 30 août 2005 à 09:09 +0200, Frank Schönheit - Sun Microsystems
Germany a écrit :
Hi Frank,
> > It seems that the default property type for a ResultSet when connecting
>
> since there are several result set implementations, it's important to
> know how you obtained the one you work with. At least, what does "MsgBox
> resuQuery.ImplementationName" say?
>
And the answer is...
com.sun.star.sdb.OResultset
> > Although I looked in the API, there doesn't appear to be any mention of
> > the default values const types that are available for certain dbs. Are
> > these types obtained from MetaData or are they statically assigned, i.e.
> > for mysql, statically assigned in the MyODBC driver ?
>
> This also depends on the implementation of your result set. Normally, if
> you obtained it at a higher level (say, by instantiating a
> css.sdb.RowSet), it should be at least SCROLL_INSENSITIVE (not
> absolutely sure, might be wrong on this).
Hmmm, that is what I thought too, although the documentation doesn't
seem to make this very clear, it just says that it gets the "default
properties" without stating what they are ;-)
> Other implementations (e.g.
> obtained directly from the driver) might behave differently. I darkly
> remember that the MySQL system driver supports only FORWARD_ONLY
> cursors, so it might well be that this restriction is just inherited by
> OOo's driver.
I suspected as much :-(
To make things easier to understand, here's the code :
Option explicit
Sub LireResultatRequeteSQL()
Dim maSource as Object, monDBContext as Object
Dim login as String, password as String, user as String
dim maRequete as Object, resuQuery as Long, resuQuery1 as Object
dim instrSQL as String, monSignet as Variant
dim execOK as Boolean, info as String, cr as String
cr = chr(13)
monDBContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
maSource = monDBContext.getByName("mybase")
maConnexion = maSource.getConnection("user","pwd")
instrSQL = "INSERT INTO file_num (file_num_id) VALUES (NULL)"
maRequete = maConnexion.createStatement()
resuQuery = maRequete.executeUpdate(instrSQL)
instrSQL = "SELECT file_num_id from file_num where file_num_id =
last_insert_id()"
maRequete = maConnexion.createStatement()
resuQuery1 = maRequete.executeQuery(instrSQL)
With resuQuery1
While .isLast = False
execOK = .next
if execOK then
info = "La nouvelle référence famille est : "
& .Columns.getByName("file_num_id").Int & cr &_
"Pour saisir cette référence, il faut rafraîchir le formulaire" &_
" en cliquant sur le bouton 'Actualiser les données'" &_
" et ensuite la choisir dans la liste déroulante 'File_Num'"
'info = "Ligne :" & .Row & " " & cr & _
'"Propriétaire = " & .Columns.getByName("Owner1").String & cr & _
' "Votre réf = " & .Columns.getByName("Y_ref").String & cr & _
' "Notre réf = " & .Columns.getByName("Our_ref").String & cr & _
' "Date de dépôt = " & .Columns.getByName("Filing_Date1").String
MsgBox(info,,"Nouvelle Référence")
else
end if
Wend
End With
DeconnecterSource
End Sub
> PS: Yes, sometimes pinging for an answer works with me, causing me to
> answer an unanswered message out-of-sequence :)
>
Thought as much ;-), thanks
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]