Обсуждение: psqlODBC ODBC3.0/Column Names

Поиск
Список
Период
Сортировка

psqlODBC ODBC3.0/Column Names

От
Dave Page
Дата:
I'm in the process of learning C#/.NET and whilst trying to persuade an
OdbcCommandBuilder to work as documented, thought I'd try the (development)
ODBC3 version of the driver to see if that was the problem.

I still haven't go the OdbcCommandBuilder to work, but I did find that with
the v3 driver, the columns appear to have lost their names. The following
code returned the names as expected with the v2.5 driver, but Column1,
Column2... with the v3:

    foreach(DataColumn dcDB in dsDB.Tables[0].Columns)
      Console.WriteLine("{0} ({1})", dcDB.ColumnName, dcDB.DataType);

I also found that the table name isn't returned for either driver, but that
may just be .NET not figuring it out correctly.

Regards, Dave.

Re: psqlODBC ODBC3.0/Column Names

От
"Hiroshi Inoue"
Дата:
> I'm in the process of learning C#/.NET and whilst trying to persuade an
> OdbcCommandBuilder to work as documented, thought I'd try the
> (development)
> ODBC3 version of the driver to see if that was the problem.
>
> I still haven't go the OdbcCommandBuilder to work, but I did find
> that with
> the v3 driver, the columns appear to have lost their names. The following
> code returned the names as expected with the v2.5 driver, but Column1,
> Column2... with the v3:

Could you send me the MyLog output ?

>     foreach(DataColumn dcDB in dsDB.Tables[0].Columns)
>       Console.WriteLine("{0} ({1})", dcDB.ColumnName, dcDB.DataType);
>
> I also found that the table name isn't returned for either
> driver,

Probably you can see the table name if you check the *Parse
Statement* option. The *Parse Statement* is the only option
that could give us the table name or the base column name
(if the column has an alias). The other options(Premature
execution or Disallow Premature) couldn't give us the infos.

regards,
Hiroshi Inoue

Re: psqlODBC ODBC3.0/Column Names

От
Dave Page
Дата:

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> Sent: 26 March 2002 21:20
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: RE: [ODBC] psqlODBC ODBC3.0/Column Names
>
>
> > I'm in the process of learning C#/.NET and whilst trying to
> persuade
> > an OdbcCommandBuilder to work as documented, thought I'd try the
> > (development)
> > ODBC3 version of the driver to see if that was the problem.
> >
> > I still haven't go the OdbcCommandBuilder to work, but I did find
> > that with
> > the v3 driver, the columns appear to have lost their names.
> The following
> > code returned the names as expected with the v2.5 driver,
> but Column1,
> > Column2... with the v3:
>
> Could you send me the MyLog output ?

The attached archive, includes logs from the 2.5 & v3 drivers from my test
program (also included so you can see what it's doing). These logs are also
relevant to the other problem I reported (subject:  .NET  ODBC Data
Provider).

> >     foreach(DataColumn dcDB in dsDB.Tables[0].Columns)
> >       Console.WriteLine("{0} ({1})", dcDB.ColumnName,
> dcDB.DataType);
> >
> > I also found that the table name isn't returned for either
> > driver,
>
> Probably you can see the table name if you check the *Parse
> Statement* option. The *Parse Statement* is the only option
> that could give us the table name or the base column name
> (if the column has an alias). The other options(Premature
> execution or Disallow Premature) couldn't give us the infos.

Parse Statement doesn't do it. It may be a .NET thing though - maybe it only
gets set if I open a table by name rather than using an SQL query which I
don't think I can do with the ODBC provider (.NET has a common DataSet class
which contains disconnected data from one or more tables in one or more data
sources - the data is put there by a DataAdaptor, for which there are OleDB,
Odbc & Sqlclient variants).

Regards, Dave.


Вложения

Re: psqlODBC ODBC3.0/Column Names

От
Hiroshi Inoue
Дата:
Dave Page wrote:
>
> > -----Original Message-----
> > From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> > Sent: 26 March 2002 21:20
> > To: Dave Page
> > Cc: pgsql-odbc@postgresql.org
> > Subject: RE: [ODBC] psqlODBC ODBC3.0/Column Names
> >
> >
> > > I'm in the process of learning C#/.NET and whilst trying to
> > persuade
> > > an OdbcCommandBuilder to work as documented, thought I'd try the
> > > (development)
> > > ODBC3 version of the driver to see if that was the problem.
> > >
> > > I still haven't go the OdbcCommandBuilder to work, but I did find
> > > that with
> > > the v3 driver, the columns appear to have lost their names.
> > The following
> > > code returned the names as expected with the v2.5 driver,
> > but Column1,
> > > Column2... with the v3:
> >
> > Could you send me the MyLog output ?
>
> The attached archive, includes logs from the 2.5 & v3 drivers from my test
> program (also included so you can see what it's doing). These logs are also
> relevant to the other problem I reported (subject:  .NET  ODBC Data
> Provider).
>
> > >     foreach(DataColumn dcDB in dsDB.Tables[0].Columns)
> > >       Console.WriteLine("{0} ({1})", dcDB.ColumnName,
> > dcDB.DataType);

Hmm I couldn't find so many info in it unfortunately.
Could you send me the above(or simpler) .NET example ?
Probably I would be able to touch a .NET environemnt.

regards,
Hiroshi Inoue

Re: psqlODBC ODBC3.0/Column Names

От
Dave Page
Дата:

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> Sent: 27 March 2002 09:44
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] psqlODBC ODBC3.0/Column Names
>
>
>
> Hmm I couldn't find so many info in it unfortunately.
> Could you send me the above(or simpler) .NET example ?
> Probably I would be able to touch a .NET environemnt.

Hmm, I thought it was in the .zip with the logs. I've attached it again
anyway. I can also do an SQL Trace if that would help?

Regards, Dave.


Вложения

Re: psqlODBC ODBC3.0/Column Names

От
"Hiroshi Inoue"
Дата:
> -----Original Message-----
> From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > -----Original Message-----
> > From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> >
> > Hmm I couldn't find so many info in it unfortunately.
> > Could you send me the above(or simpler) .NET example ?
> > Probably I would be able to touch a .NET environemnt.
>
> Hmm, I thought it was in the .zip with the logs. I've attached it again
> anyway.

Oops I overlooked it sorry.

> I can also do an SQL Trace if that would help?

Yes. I 'm not able to touch .NET yet unfortunately.

regards,
Hiroshi Inoue

Re: psqlODBC ODBC3.0/Column Names

От
Dave Page
Дата:

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> Sent: 27 March 2002 20:37
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] psqlODBC ODBC3.0/Column Names
>
>
> > -----Original Message-----
> > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > > -----Original Message-----
> > > From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> > >
> > > Hmm I couldn't find so many info in it unfortunately.
> > > Could you send me the above(or simpler) .NET example ? Probably I
> > > would be able to touch a .NET environemnt.
> >
> > Hmm, I thought it was in the .zip with the logs. I've attached it
> > again anyway.
>
> Oops I overlooked it sorry.
>
> > I can also do an SQL Trace if that would help?
>

Attached. This represents a complete run of the program using the v3 driver.
I have changed the references to the column names in the program to Column1
etc. just to stop it erroring.

Regards, Dave.


Вложения

Re: psqlODBC ODBC3.0/Column Names

От
Hiroshi Inoue
Дата:
Dave Page wrote:
>
> > -----Original Message-----
> > From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> > Sent: 27 March 2002 20:37
> > To: Dave Page
> > Cc: pgsql-odbc@postgresql.org
> > Subject: Re: [ODBC] psqlODBC ODBC3.0/Column Names
> >
> >
> > > -----Original Message-----
> > > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > > > -----Original Message-----
> > > > From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> > > >
> > > > Hmm I couldn't find so many info in it unfortunately.
> > > > Could you send me the above(or simpler) .NET example ? Probably I
> > > > would be able to touch a .NET environemnt.
> > >
> > > Hmm, I thought it was in the .zip with the logs. I've attached it
> > > again anyway.
> >
> > Oops I overlooked it sorry.
> >
> > > I can also do an SQL Trace if that would help?
> >
>
> Attached. This represents a complete run of the program using the v3 driver.
> I have changed the references to the column names in the program to Column1
> etc. just to stop it erroring.

You seem to be forgetting to call DataAdapter.Update method.

regards,
Hiroshi Inoue

Re: psqlODBC ODBC3.0/Column Names

От
Dave Page
Дата:

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> Sent: 28 March 2002 04:26
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] psqlODBC ODBC3.0/Column Names
>
>
> Dave Page wrote:
> >
> > > -----Original Message-----
> > > From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> > > Sent: 27 March 2002 20:37
> > > To: Dave Page
> > > Cc: pgsql-odbc@postgresql.org
> > > Subject: Re: [ODBC] psqlODBC ODBC3.0/Column Names
> > >
> > >
> > > > -----Original Message-----
> > > > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > > > > -----Original Message-----
> > > > > From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> > > > >
> > > > > Hmm I couldn't find so many info in it unfortunately.
> Could you
> > > > > send me the above(or simpler) .NET example ? Probably
> I would be
> > > > > able to touch a .NET environemnt.
> > > >
> > > > Hmm, I thought it was in the .zip with the logs. I've
> attached it
> > > > again anyway.
> > >
> > > Oops I overlooked it sorry.
> > >
> > > > I can also do an SQL Trace if that would help?
> > >
> >
> > Attached. This represents a complete run of the program
> using the v3
> > driver. I have changed the references to the column names in the
> > program to Column1 etc. just to stop it erroring.
>
> You seem to be forgetting to call DataAdapter.Update method.

Yes, thanks. Unfortunately though, both my problems remain.

- The ODBC3 driver returns 'Column1','Column2' etc as the column names (the
2.5 driver is fine).

- DataAdapter.Update won't work (yet) because the OdbcCommandBuilder won't
generate the insert/update/delete queries *I assume* because the driver
doesn't give it all the info it needs (the errors in the logs?). Manually
building the queries and their associated parameters is possible (but a
*lot* of work) assuming you have knowledge of the database at design time.
Of course, with something like pgAdmin this is not possible.

Regards, Dave.

Re: psqlODBC ODBC3.0/Column Names

От
"Hiroshi Inoue"
Дата:
> -----Original Message-----
> From: Dave Page [mailto:dpage@vale-housing.co.uk]
> >
> > > Attached. This represents a complete run of the program
> > using the v3
> > > driver. I have changed the references to the column names in the
> > > program to Column1 etc. just to stop it erroring.
> >
> > You seem to be forgetting to call DataAdapter.Update method.
>
> Yes, thanks. Unfortunately though, both my problems remain.
>
> - The ODBC3 driver returns 'Column1','Column2' etc as the column
> names (the
> 2.5 driver is fine).

Hmm I see neither here.
Please try the latest driver at http://w2422.nsk.ne.jp/~inoue/ .
No explicit OdbcCommandBuilder is needed.

regards,
Hiroshi Inoue

Re: psqlODBC ODBC3.0/Column Names

От
Dave Page
Дата:

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> Sent: 28 March 2002 13:45
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] psqlODBC ODBC3.0/Column Names
>
>
> > -----Original Message-----
> > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > >
> > > > Attached. This represents a complete run of the program
> > > using the v3
> > > > driver. I have changed the references to the column names in the
> > > > program to Column1 etc. just to stop it erroring.
> > >
> > > You seem to be forgetting to call DataAdapter.Update method.
> >
> > Yes, thanks. Unfortunately though, both my problems remain.
> >
> > - The ODBC3 driver returns 'Column1','Column2' etc as the column
> > names (the
> > 2.5 driver is fine).
>
> Hmm I see neither here.
> Please try the latest driver at
> http://w2422.nsk.ne.jp/~inoue/ . No explicit
> OdbcCommandBuilder is needed.

Aha. The unicode enabled v3 driver is returning the column names correctly.
Thanks.

I'm still not getting update/insert/delete commands though, either with or
without the OdbcCommandBuilder. I must admit confused by you saying I don't
need it though, I thought the whole point was that the DataAdaptor *didn't*
spend time figuring out the queries & their parameters unless explicitly
told to (from the Microsoft docs):

The OdbcDataAdapter does not automatically generate the SQL statements
required to reconcile changes made to a DataSet associated with the data
source. However, you can create an OdbcCommandBuilder object that generates
SQL statements for single-table updates by setting the SelectCommand
property of the OdbcDataAdapter. Then, the OdbcCommandBuilder generates any
additional SQL statements that you do not set.

Regards, Dave.

Re: psqlODBC ODBC3.0/Column Names

От
"Hiroshi Inoue"
Дата:
> -----Original Message-----
> From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > > > You seem to be forgetting to call DataAdapter.Update method.
> > >
> > > Yes, thanks. Unfortunately though, both my problems remain.
> > >
> > > - The ODBC3 driver returns 'Column1','Column2' etc as the column
> > > names (the
> > > 2.5 driver is fine).
> >
> > Hmm I see neither here.
> > Please try the latest driver at
> > http://w2422.nsk.ne.jp/~inoue/ . No explicit
> > OdbcCommandBuilder is needed.
>
> Aha. The unicode enabled v3 driver is returning the column names
> correctly.
> Thanks.
>
> I'm still not getting update/insert/delete commands though, either with or
> without the OdbcCommandBuilder. I must admit confused by you
> saying I don't
> need it though, I thought the whole point was that the
> DataAdaptor *didn't*
> spend time figuring out the queries & their parameters unless explicitly
> told to (from the Microsoft docs):

Sorry the statement
        OdbcCommandBuilder cbDB = new OdbcCommandBuilder(adDB);
seems to be needed.
I can add a row by adding the statement
    adDB.Update(dsDB);
after the statement
    dsDB.Tables[0].Rows.Add(rwDB);

regards,
Hiroshi Inoue


Re: psqlODBC ODBC3.0/Column Names

От
Dave Page
Дата:

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> Sent: 29 March 2002 16:29
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: RE: [ODBC] psqlODBC ODBC3.0/Column Names
>
>
> > -----Original Message-----
> > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > > > > You seem to be forgetting to call DataAdapter.Update method.
> > > >
> > > > Yes, thanks. Unfortunately though, both my problems remain.
> > > >
> > > > - The ODBC3 driver returns 'Column1','Column2' etc as
> the column
> > > > names (the 2.5 driver is fine).
> > >
> > > Hmm I see neither here.
> > > Please try the latest driver at
> http://w2422.nsk.ne.jp/~inoue/ . No
> > > explicit
> OdbcCommandBuilder is needed.
> >
> > Aha. The unicode enabled v3 driver is returning the column names
> > correctly. Thanks.
> >
> > I'm still not getting update/insert/delete commands though, either
> > with or without the OdbcCommandBuilder. I must admit
> confused by you
> > saying I don't need it though, I thought the whole point
> was that the
> > DataAdaptor *didn't*
> > spend time figuring out the queries & their parameters
> unless explicitly
> > told to (from the Microsoft docs):
>
> Sorry the statement
>         OdbcCommandBuilder cbDB = new OdbcCommandBuilder(adDB);
> seems to be needed. I can add a row by adding the statement
>     adDB.Update(dsDB);
> after the statement
>     dsDB.Tables[0].Rows.Add(rwDB);

Strange, That works perfectly, thanks. I put it after the following line
which is:

    dsDB.Tables[0].AcceptChanges();

Obviously that doesn't do quote what I thought.

Thanks again,

Regards, Dave.