[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Creating typed datasets from an ODBC source

Steven Spits

6/13/2002 9:17:00 AM

Hi,

I've done a search on Google, but I did not found an answer to my problem.
Sorry if it has been asked before!

We're using a database that doesn't support OLE DB (don't ask!), so I
installed the Microsoft.Data.ODBC namespace to connect. This works fine!

But I was used to working with SQL-Server, where I could drag any table from
the Server Explorer into my form. This would create the connection, adapter
and dataset. It was also possible to create a typed dataset just by
clicking... Really neat!

Can this also be done with an ODBC source? I've noticed I can't drag the
tables into my form ("you cannot use a OLE DB provider for ODBC drivers").
What other options do I have? Code everything by hand? If so, how can I
easily created typed datasets? Also by creating the XSD by hand?

With kind regards,

Steven Spits

- - -




1 Answer

Bob Beauchemin

6/13/2002 3:38:00 PM

0

I don't know if this constitutes "by hand" (probably does) but:

DataSet ds = new DataSet("yourDataSetName");
OdbcDataAdapter da = new OdbcDataAdapter(
"your command string", "your connect string");
// usually get strong typing by adding this
// but sometimes gratuitous columns appear
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.Fill(ds, "yourResultsetName");
ds.WriteXmlSchema("c:\\somefile.xsd");

Then, on the command line:
xsd /d c:\somefile.xsd

Hope this helps,
Bob Beauchemin
bobb@develop.com



"Steven Spits" <steven.spits@servico.be> wrote in message
news:#iX5qoqECHA.2164@tkmsftngp02...
> Hi,
>
> I've done a search on Google, but I did not found an answer to my problem.
> Sorry if it has been asked before!
>
> We're using a database that doesn't support OLE DB (don't ask!), so I
> installed the Microsoft.Data.ODBC namespace to connect. This works fine!
>
> But I was used to working with SQL-Server, where I could drag any table
from
> the Server Explorer into my form. This would create the connection,
adapter
> and dataset. It was also possible to create a typed dataset just by
> clicking... Really neat!
>
> Can this also be done with an ODBC source? I've noticed I can't drag the
> tables into my form ("you cannot use a OLE DB provider for ODBC drivers").
> What other options do I have? Code everything by hand? If so, how can I
> easily created typed datasets? Also by creating the XSD by hand?
>
> With kind regards,
>
> Steven Spits
>
> - - -
>
>
>
>