By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,694 Members | 1,882 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,694 IT Pros & Developers. It's quick & easy.

ODBC API

P: n/a
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

Nov 15 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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" <pr*****@yahoo.co.in> wrote in message
news:EB**********************************@microsof t.com...
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

Nov 15 '05 #2

P: n/a
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" <pr*****@yahoo.co.in>
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


Nov 15 '05 #3

P: n/a
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" <pr*****@yahoo.co.in> wrote in message
news:EB**********************************@microsof t.com...
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

Nov 15 '05 #4

P: n/a
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" <pr*****@yahoo.co.in> wrote in message
news:EB**********************************@microsof t.com...
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

Nov 15 '05 #5

P: n/a
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" <rl****@twt.obfuscate.net> wrote in message
news:et**************@TK2MSFTNGP12.phx.gbl...
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" <pr*****@yahoo.co.in> wrote in message
news:EB**********************************@microsof t.com...
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


Nov 16 '05 #6

P: n/a
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" <rl****@twt.obfuscate.net> wrote in message
news:et**************@TK2MSFTNGP12.phx.gbl...
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" <pr*****@yahoo.co.in> wrote in message
news:EB**********************************@microsof t.com...
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


Nov 16 '05 #7

P: n/a
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" <rl****@twt.obfuscate.net> wrote in message
news:et**************@TK2MSFTNGP12.phx.gbl...
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" <pr*****@yahoo.co.in> wrote in message
news:EB**********************************@microsof t.com...
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


Nov 16 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.