PC Review


Reply
 
 
=?Utf-8?B?QXJydW4gUw==?=
Guest
Posts: n/a
 
      4th Feb 2004
Hi
I don't know how to access the ODBC API through C#. The VS.NET provides OLEDB Data Provider but not ODBC
E.g., select * from tbl where id=
To get the data type (description) of the column 'id', the ODBC provides a function 'SQLDescribeParam()'. But, I don't know how to access this function through C#.Could anyone help me
TIA
Arrun

 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      4th Feb 2004
Hi Arrun,

Have yo checked System.Data.Odbc namespace?
It comes with .net 1.1.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Arrun S" <(E-Mail Removed)> wrote in message
news:EB0A9737-619A-4EDB-9155-(E-Mail Removed)...
> Hi
> I don't know how to access the ODBC API through C#. The VS.NET provides

OLEDB Data Provider but not ODBC.
> E.g., select * from tbl where id=?
> To get the data type (description) of the column 'id', the ODBC provides

a function 'SQLDescribeParam()'. But, I don't know how to access this
function through C#.Could anyone help me?
> TIA,
> Arrun S
>



 
Reply With Quote
 
=?Utf-8?B?QXJydW4gUw==?=
Guest
Posts: n/a
 
      4th Feb 2004
Hi Miha
Thanks for the answer. Is it not possible with .NET 1.0 (which I am using)

----- Miha Markic [MVP C#] wrote: ----

Hi Arrun

Have yo checked System.Data.Odbc namespace
It comes with .net 1.1

--
Miha Markic [MVP C#] - RightHand .NET consulting & software developmen
miha at rthand co
www.rthand.co

"Arrun S" <(E-Mail Removed)> wrote in messag
news:EB0A9737-619A-4EDB-9155-(E-Mail Removed)..
> H
> I don't know how to access the ODBC API through C#. The VS.NET provide

OLEDB Data Provider but not ODBC
> E.g., select * from tbl where id=
> To get the data type (description) of the column 'id', the ODBC provide

a function 'SQLDescribeParam()'. But, I don't know how to access thi
function through C#.Could anyone help me
> TIA
> Arrun
>

 
Reply With Quote
 
Gabriele G. Ponti
Guest
Posts: n/a
 
      4th Feb 2004
ODBC .NET Framework Data Provider
http://www.microsoft.com/downloads/d...displaylang=en


 
Reply With Quote
 
Austin Ehlers
Guest
Posts: n/a
 
      4th Feb 2004
Have you installed the ODBC .NET Data Provider?

http://www.microsoft.com/downloads/d...displaylang=en

Austin

On Tue, 3 Feb 2004 23:36:05 -0800, "Arrun S" <(E-Mail Removed)>
wrote:

>Hi
> I don't know how to access the ODBC API through C#. The VS.NET provides OLEDB Data Provider but not ODBC.
>E.g., select * from tbl where id=?
> To get the data type (description) of the column 'id', the ODBC provides a function 'SQLDescribeParam()'. But, I don't know how to access this function through C#.Could anyone help me?
>TIA,
>Arrun S


 
Reply With Quote
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      5th Feb 2004
ODBC is built into the 1.1 version of the Framework. It can be downloaded
and used with version 1.0.
However, this is NOT the ODBC API. As I wrote in my books quite some time
ago, the ODBC API requires "Declare" statements the tie the API entry points
to VB functions and subroutines. There is no publicly available set of
headers for use in .NET languages--not that I've heard of.

What are you trying to do? While you can get at the ODBC drivers, the API
interfaces are tough to get to.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Arrun S" <(E-Mail Removed)> wrote in message
news:EB0A9737-619A-4EDB-9155-(E-Mail Removed)...
> Hi
> I don't know how to access the ODBC API through C#. The VS.NET provides

OLEDB Data Provider but not ODBC.
> E.g., select * from tbl where id=?
> To get the data type (description) of the column 'id', the ODBC provides

a function 'SQLDescribeParam()'. But, I don't know how to access this
function through C#.Could anyone help me?
> TIA,
> Arrun S
>



 
Reply With Quote
 
Roy Fine
Guest
Posts: n/a
 
      5th Feb 2004
Arrun,

SQLDescribeParam is a system API call - you would have to use P/Invoke to
get to that one. That's the short answer.

The long answer is that accessing data using the ODBC API is sufficiently
difficult in C#, and the benefits are so few, you are better off looking for
another solution.

For ADO.Net, if you need schema info on a column returned from a server, use
the GetSchemaTable method on the DataReader object.

The GetSchemaTable method works similar to the ODBC API call, in that the
API call works on the prepared statement - there is a round trip to the
server, but the statement does not have to be executed. Using the data
reader approach requires the behavior parameter to be set to SchemaOnly (or
KeyInfo if you want to execute the select query, and get data and schema
info in one trip)

best regards
roy fine


"Arrun S" <(E-Mail Removed)> wrote in message
news:EB0A9737-619A-4EDB-9155-(E-Mail Removed)...
> Hi
> I don't know how to access the ODBC API through C#. The VS.NET provides

OLEDB Data Provider but not ODBC.
> E.g., select * from tbl where id=?
> To get the data type (description) of the column 'id', the ODBC provides

a function 'SQLDescribeParam()'. But, I don't know how to access this
function through C#.Could anyone help me?
> TIA,
> Arrun S
>



 
Reply With Quote
 
Tony
Guest
Posts: n/a
 
      2nd Apr 2004
This only works if you know what table you want to go after.

What if you need a list of tables, indexes, etc.

Also I need to know what server I'm talking to (Oracle or SQL Server)
because the SQL Syntax is different.

Tony

"Roy Fine" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Arrun,
>
> SQLDescribeParam is a system API call - you would have to use P/Invoke to
> get to that one. That's the short answer.
>
> The long answer is that accessing data using the ODBC API is sufficiently
> difficult in C#, and the benefits are so few, you are better off looking

for
> another solution.
>
> For ADO.Net, if you need schema info on a column returned from a server,

use
> the GetSchemaTable method on the DataReader object.
>
> The GetSchemaTable method works similar to the ODBC API call, in that the
> API call works on the prepared statement - there is a round trip to the
> server, but the statement does not have to be executed. Using the data
> reader approach requires the behavior parameter to be set to SchemaOnly

(or
> KeyInfo if you want to execute the select query, and get data and schema
> info in one trip)
>
> best regards
> roy fine
>
>
> "Arrun S" <(E-Mail Removed)> wrote in message
> news:EB0A9737-619A-4EDB-9155-(E-Mail Removed)...
> > Hi
> > I don't know how to access the ODBC API through C#. The VS.NET

provides
> OLEDB Data Provider but not ODBC.
> > E.g., select * from tbl where id=?
> > To get the data type (description) of the column 'id', the ODBC

provides
> a function 'SQLDescribeParam()'. But, I don't know how to access this
> function through C#.Could anyone help me?
> > TIA,
> > Arrun S
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access link ODBC to SQL table,path to ODBC -recent install? =?Utf-8?B?TFdpbkZsb3JpZGE=?= Microsoft Access External Data 1 28th Sep 2006 03:32 AM
ODBC Error 3151 on conection of MYSql ODBC Connection =?Utf-8?B?a2ZzY2hhZWZlcg==?= Microsoft Access VBA Modules 0 24th Mar 2006 08:45 PM
ODBC driver shows in registry key but not under ODBC Administrator =?Utf-8?B?bG91XzE=?= Windows XP General 5 8th Dec 2005 09:27 PM
ODBC Call Failed with complete Connect string but not with ODBC only. =?Utf-8?B?QmV0YWNvbg==?= Microsoft Access Form Coding 1 19th Feb 2004 02:05 PM
ODBC reinstallation required opening ODBC administrator. Jose Forero Microsoft Windows 2000 0 3rd Oct 2003 09:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:12 PM.