Re: basic questions with odbc and visual basic.

From: "Greg Campbell" <greg(dot)campbell(at)us(dot)michelin(dot)com>
To: Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: basic questions with odbc and visual basic.
Date: 2004-09-27 18:55:28
Message-ID: 41586220.2010605@us.michelin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

I have done a fair amount with VB and PostgreSQL ODBC and I am perplexed
by what you have described as your problem. You make it sound as it VB
is "making up" the SQL statements to send.

My update sections, typically look like:

Dim cnn as connection
Dim sql_str as string

cnn.Open "my_datasource_specificatin_goes_here"
sql_str = "UPDATE t set f1=a WHERE f2=c"
cnn.Execute sql_str
cnn.Close
set cnn = Nothing

Of course, my SQL strings are usually a complex concatention of
variables and such.
This is practically a pass-through query. Logging on the client and
server should verify this.

Did you leave out some information, like you are using a bound data
control perhaps?

You mentioned Access. I could say look for the abundant information on
Access issues. If you are trying to update from data table view in
Access -- I suggest make sure you have a primary key on your server
table, turn row-versioning on in the PostgreSQL driver. Try it on a
table with OIDs and without OIDs to see if it makes a difference for
you. This only applies to data table view. Updating in code modules is a
programmer issue about using ADO.

Merlin Moncure wrote:

>Hello,
>
>I have some basic questions regarding visual basic and odbc. So far,
>I've been having problems getting Visual Basic/Access to write data back
>to my database via odbc. Normally I use Delphi for this type of thing,
>but some of our clients are insisting on vb 6.0 access.
>
>The biggest problem I have is that updating data from a VB app always
>fails...the problem is that at update time ADO builds a where clause
>containing every field in the table, not just the primary key.
>Invariably, this causes the update to not to work. If I have some type
>of integer primary key for my table is there some way of forcing the
>driver row resolution to write queries in the form of
>
>update t set [] where f = k?
>
>instead of
>
>update t set [] where f1 = a, f2 = b, f3 = c [...] for all the fields in
>t?
>
>
>Merlin
>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faqs/FAQ.html
>
>

Attachment Content-Type Size
greg.campbell.vcf text/x-vcard 283 bytes

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Gary Doades 2004-09-27 18:59:10 Re: basic questions with odbc and visual basic.
Previous Message Sandahl, Dan 2004-09-27 18:44:37 Migrating Microsoft Project Files to PostgreSQL