Re: Problems with MS Visual Basic 6.0

Поиск
Список
Период
Сортировка
От Andrew Ayers
Тема Re: Problems with MS Visual Basic 6.0
Дата
Msg-id 411931A2.40908@eldocomp.com
обсуждение исходный текст
Ответ на Problems with MS Visual Basic 6.0  ("Brigitte ROLLAND" <luc@rolland-fr.com>)
Список pgsql-general
Brigitte ROLLAND wrote:
> Hello !
> I need to intreact from VB6 with an PG 7.4.3 database, I've
> psqlodbc-7_03_0200 installed.
> I use the Microsoft ADO Data Control 6.0, and I've installed the SP5 for
> VB6.

Luc,

I have never used the ADO Data Control, so I can't be much help there -
I can tell you what I have done with a project I work on, which I have
converted to use PG via ODBC. Please note that I won't tell you
everything here, I have posted numerous times to both this list
[GENERAL] and the ODBC list on this issue - so search the archives.

> When I use the adodc control I see the data but I've problems with :
> - Update, on existing records : do nothing, I've to MoveFirst to store
> in database ! Why ?

For my project, I use the ActiveX Data Objects 2.7 Library for my
access. Even so, I have found that I need to do a
".movelast"/".movefirst" sequence in order to use the recordset I
return. I am not sure why this is, either - I have just accepted it and
moved on. Maybe the pointer in the recordset is on the last record, not
the first? Dunno...

> - Edit Method don't exist for that object, so EditMode properties is non
> signifiant,

Correct. Same for what I am doing. This is part of ADO (vs. DAO).

> - I can't update if I :
>     use CheckBox control,
>     use textBox control with a date.

Because you are using a control, and not the method I am using - I am
not sure how you can resolve this. I have found that for date type
fields that I can update them by using cdate():

ie, ![datefield] = cdate(text1.text)

Checkboxes I store in boolean fields, by taking the absolute value of
the checkbox value and storing that:

ie, ![booleanfield] = abs(checkbox.value)

Alternatively, you can also say:

![booleanfield] = (checkbox.value = 1)

> How can I resolve these points ?
> Regards.
> Luc

The basics of what I do to get a recordset for update/reading is as follows:

Dim conn As New ADODB.Connection
Dim recs As New ADODB.Recordset
'
' Open DSN-less ADO connection to database
'
Set conn = New ADODB.Connection
'
' In the following, replace the ??? in the connection string with values
' appropriate for your application.
'
conn.Open "driver={PostgreSQL};server=???;port=???;database=???;_
    uid=???;pwd=???;ksqo=;"
'
' Retrieve recordset from table
'
Set recs = New ADODB.Recordset
'
recs.CursorLocation = adUseServer
'
recs.Open "SELECT * FROM ???", conn, adOpenDynamic, adLockOptimistic,_
    adCmdText
'
' Manipulate recordset
'
With recs
   '
   If Not (.BOF And .EOF) Then
     '
     .MoveLast
     .MoveFirst
     '
     ' Update/Add/Read stuff here
     '
   End If
   '
   .Close
   '
End With
'
Set recs = Nothing
'
' Close database connection
'
Set conn = Nothing

---

More information on all this, as I noted, is in the archives of this
list and the ODBC list (in fact, most of the it is probably in the ODBC
list, since I was posting there quite a lot when I did the conversion).

I know that the above is probably vastly different from using the ADO
control itself, but hopefully it might give you some ideas and insight
to allow you to get your application working...

Hope this helps,

Andrew Ayers
Phoenix, Arizona

-- CONFIDENTIALITY NOTICE --

This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain
informationthat is privileged, confidential and exempt from disclosure under applicable law. If you are not the
intendedaddressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use,
copy,disclose or distribute to anyone the message or any information contained in the message. If you have received
thismessage in error, please immediately advise the sender by reply email, and delete the message. Thank you. 

В списке pgsql-general по дате отправления:

Предыдущее
От: Franco Bruno Borghesi
Дата:
Сообщение: Re: Postgres update with self join
Следующее
От: "Liam Lesboch"
Дата:
Сообщение: Re: Replication options?