473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Programmatically Create Oracle Typed DataSets?

Hi,

Is it possible to create a progam to mimic the following action

a) drag oledbadapter to form1.cs
b) select my oracle ole connection
c) enter 'select * from mytable'
d) create adapter for select only (no updates)
e) repeat for all my tables
f) generate dataset for all the those adapters/tables

Doing by hand is going to be a little tedious for my 500 tables...
I need the typed dataset

thanks!

Tim
Nov 16 '05 #1
7 2513
Tim,

Good news, it is actually possible.

One gotcha - all your typed datasets will have to map an equivalent SQL
Query/Table/Stored proc in your oracle database (not a big deal huh?).

OracleDataAdapter and OleDBDataAdapter (and SqlDataAdapter should u care
for) should have a FillSchema method on it, use that to cread XSD files,
then run XSD.EXE to create .cs or .vb files to generate strongly typed
datasets out of that.

One word of caution - donot use FillSchema in a production application, the
query that it executes is hella expensive. Pre-prepare your strongly typed
datasets to include in your app, don't generate them on the fly.

Hope that helps.

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/

"Tim Smith" <ti*******@hotmail.com> wrote in message
news:a7**************************@posting.google.c om...
Hi,

Is it possible to create a progam to mimic the following action

a) drag oledbadapter to form1.cs
b) select my oracle ole connection
c) enter 'select * from mytable'
d) create adapter for select only (no updates)
e) repeat for all my tables
f) generate dataset for all the those adapters/tables

Doing by hand is going to be a little tedious for my 500 tables...
I need the typed dataset

thanks!

Tim

Nov 16 '05 #2
Hi Tim,

I would recommend CodeSmith (free template based code generator) for such
features.
www.ericjsmith.net/codesmith/
You might also take a look at my few templates for CodeSmith:
http://www.rthand.com/default.aspx?Page=2&SubPage=1#4

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
"Tim Smith" <ti*******@hotmail.com> wrote in message
news:a7**************************@posting.google.c om...
Hi,

Is it possible to create a progam to mimic the following action

a) drag oledbadapter to form1.cs
b) select my oracle ole connection
c) enter 'select * from mytable'
d) create adapter for select only (no updates)
e) repeat for all my tables
f) generate dataset for all the those adapters/tables

Doing by hand is going to be a little tedious for my 500 tables...
I need the typed dataset

thanks!

Tim

Nov 16 '05 #3
If you already have the DataAdapters set up, you can use WriteXML from the
DataSet. You will have to be filling the same DataSet with all of the
adapters, of course.

Now, create a new DataSet object and copy the XML from the .xsd you created
with WriteXML. Then, you only need to change the DataSet declaration from
DataSet to your new name, like so:

DataSet DataSet1 = new DataSet();

MyStName DataSet1 = new DataSet();

There is no tool to do all of this, however. If you wanted to create a tool,
there is a table in oracle called ALL_ALL_TABLES to get table names. If you
want to figure out sprocs in the database, ALL_SOURCE is your baby. NOTE:
You will have to have perms to hit these tables.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Tim Smith" <ti*******@hotmail.com> wrote in message
news:a7**************************@posting.google.c om...
Hi,

Is it possible to create a progam to mimic the following action

a) drag oledbadapter to form1.cs
b) select my oracle ole connection
c) enter 'select * from mytable'
d) create adapter for select only (no updates)
e) repeat for all my tables
f) generate dataset for all the those adapters/tables

Doing by hand is going to be a little tedious for my 500 tables...
I need the typed dataset

thanks!

Tim

Nov 16 '05 #4
Gregory,

I hope you mean WriteXML with the XmlMode = WriteSchema?? Just
clarifying/making sure/checking my own feet here. :)

Why not just DataAdapter.FillSchema then?

I agree with your assessment - there is no tool to do this directly, and
even for FillSchema to work, you need permissions to hit all those tables -
even in SQL Server.

- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/

"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM> wrote
in message news:uP**************@TK2MSFTNGP09.phx.gbl...
If you already have the DataAdapters set up, you can use WriteXML from the
DataSet. You will have to be filling the same DataSet with all of the
adapters, of course.

Now, create a new DataSet object and copy the XML from the .xsd you created with WriteXML. Then, you only need to change the DataSet declaration from
DataSet to your new name, like so:

DataSet DataSet1 = new DataSet();

MyStName DataSet1 = new DataSet();

There is no tool to do all of this, however. If you wanted to create a tool, there is a table in oracle called ALL_ALL_TABLES to get table names. If you want to figure out sprocs in the database, ALL_SOURCE is your baby. NOTE:
You will have to have perms to hit these tables.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Tim Smith" <ti*******@hotmail.com> wrote in message
news:a7**************************@posting.google.c om...
Hi,

Is it possible to create a progam to mimic the following action

a) drag oledbadapter to form1.cs
b) select my oracle ole connection
c) enter 'select * from mytable'
d) create adapter for select only (no updates)
e) repeat for all my tables
f) generate dataset for all the those adapters/tables

Doing by hand is going to be a little tedious for my 500 tables...
I need the typed dataset

thanks!

Tim


Nov 16 '05 #5
BTW, this is exactly what you need (I hope) -

http://www.gotdotnet.com/Community/U...b-2a6de230a3a3

- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/

"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM> wrote
in message news:uP**************@TK2MSFTNGP09.phx.gbl...
If you already have the DataAdapters set up, you can use WriteXML from the
DataSet. You will have to be filling the same DataSet with all of the
adapters, of course.

Now, create a new DataSet object and copy the XML from the .xsd you created with WriteXML. Then, you only need to change the DataSet declaration from
DataSet to your new name, like so:

DataSet DataSet1 = new DataSet();

MyStName DataSet1 = new DataSet();

There is no tool to do all of this, however. If you wanted to create a tool, there is a table in oracle called ALL_ALL_TABLES to get table names. If you want to figure out sprocs in the database, ALL_SOURCE is your baby. NOTE:
You will have to have perms to hit these tables.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Tim Smith" <ti*******@hotmail.com> wrote in message
news:a7**************************@posting.google.c om...
Hi,

Is it possible to create a progam to mimic the following action

a) drag oledbadapter to form1.cs
b) select my oracle ole connection
c) enter 'select * from mytable'
d) create adapter for select only (no updates)
e) repeat for all my tables
f) generate dataset for all the those adapters/tables

Doing by hand is going to be a little tedious for my 500 tables...
I need the typed dataset

thanks!

Tim


Nov 16 '05 #6
I was shortcutting the idea, technically:

dataSet.WriteXMLSchema(fileName); //filename ends with .xsd

The import into the project can be done graphically in the IDE or in a text
editor by copying the XML.

I do like the other link you posted, BTW. Interesting code gen tool.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Sahil Malik" <co*****************@nospam.com> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Gregory,

I hope you mean WriteXML with the XmlMode = WriteSchema?? Just
clarifying/making sure/checking my own feet here. :)

Why not just DataAdapter.FillSchema then?

I agree with your assessment - there is no tool to do this directly, and
even for FillSchema to work, you need permissions to hit all those tables - even in SQL Server.

- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/
"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM> wrote in message news:uP**************@TK2MSFTNGP09.phx.gbl...
If you already have the DataAdapters set up, you can use WriteXML from the DataSet. You will have to be filling the same DataSet with all of the
adapters, of course.

Now, create a new DataSet object and copy the XML from the .xsd you

created
with WriteXML. Then, you only need to change the DataSet declaration from DataSet to your new name, like so:

DataSet DataSet1 = new DataSet();

MyStName DataSet1 = new DataSet();

There is no tool to do all of this, however. If you wanted to create a

tool,
there is a table in oracle called ALL_ALL_TABLES to get table names. If

you
want to figure out sprocs in the database, ALL_SOURCE is your baby. NOTE: You will have to have perms to hit these tables.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Tim Smith" <ti*******@hotmail.com> wrote in message
news:a7**************************@posting.google.c om...
Hi,

Is it possible to create a progam to mimic the following action

a) drag oledbadapter to form1.cs
b) select my oracle ole connection
c) enter 'select * from mytable'
d) create adapter for select only (no updates)
e) repeat for all my tables
f) generate dataset for all the those adapters/tables

Doing by hand is going to be a little tedious for my 500 tables...
I need the typed dataset

thanks!

Tim




Nov 16 '05 #7
Oh okay Dataset.WriteXMLSchema <--- that'll work. The "WriteXML" threw me
off.

- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/

"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM> wrote
in message news:ez*************@TK2MSFTNGP11.phx.gbl...
I was shortcutting the idea, technically:

dataSet.WriteXMLSchema(fileName); //filename ends with .xsd

The import into the project can be done graphically in the IDE or in a text editor by copying the XML.

I do like the other link you posted, BTW. Interesting code gen tool.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Sahil Malik" <co*****************@nospam.com> wrote in message
news:OE**************@tk2msftngp13.phx.gbl...
Gregory,

I hope you mean WriteXML with the XmlMode = WriteSchema?? Just
clarifying/making sure/checking my own feet here. :)

Why not just DataAdapter.FillSchema then?

I agree with your assessment - there is no tool to do this directly, and
even for FillSchema to work, you need permissions to hit all those

tables -
even in SQL Server.

- Sahil Malik
Independent Consultant
You can reach me thru my blog -

http://dotnetjunkies.com/WebLog/sahilmalik/

"Cowboy (Gregory A. Beamer) [MVP]" <No************@comcast.netNoSpamM>

wrote
in message news:uP**************@TK2MSFTNGP09.phx.gbl...
If you already have the DataAdapters set up, you can use WriteXML from the DataSet. You will have to be filling the same DataSet with all of the
adapters, of course.

Now, create a new DataSet object and copy the XML from the .xsd you

created
with WriteXML. Then, you only need to change the DataSet declaration from DataSet to your new name, like so:

DataSet DataSet1 = new DataSet();

MyStName DataSet1 = new DataSet();

There is no tool to do all of this, however. If you wanted to create a

tool,
there is a table in oracle called ALL_ALL_TABLES to get table names.
If
you
want to figure out sprocs in the database, ALL_SOURCE is your baby.

NOTE: You will have to have perms to hit these tables.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Tim Smith" <ti*******@hotmail.com> wrote in message
news:a7**************************@posting.google.c om...
> Hi,
>
> Is it possible to create a progam to mimic the following action
>
> a) drag oledbadapter to form1.cs
> b) select my oracle ole connection
> c) enter 'select * from mytable'
> d) create adapter for select only (no updates)
> e) repeat for all my tables
> f) generate dataset for all the those adapters/tables
>
> Doing by hand is going to be a little tedious for my 500 tables...
> I need the typed dataset
>
> thanks!
>
> Tim



Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bj?rn Mor?n | last post by:
I am consuming a web service that returns arrays of classes which can contain other classes (a hierarchy of data). Is there a simple way to move the data into a typed DataSet without writing too...
3
by: R Reyes | last post by:
Just wondering if anyone knows the pros/cons between creating a database programmatically vs using the application's tool windows/features that come with SQLServer, Access, Oracle, etc... Is it...
7
by: Bob | last post by:
Hi, I have a typed unbound dataset that is passed to a datahandling class to be filled. The datahandling class fills it from a sproc using an oledbDataAdapter (SQLAnywhere database) The only...
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
3
by: Mike | last post by:
Hi, I'm delevloping a webservice that returns typed datasets with visual studio 2005. The problem is, that the typed data set in the client app is not the same as in the webservice. If I change...
13
by: Bill Nguyen | last post by:
Is it possible to create your won XSD to use with .NET based on an XML content? For example the one below: <?xml version="1.0"?> <pcats:FuelsDoc...
2
by: DC | last post by:
Hi, I can easily create an xsd from an xml file in Visual Studio 2005. But I want a typed DataSet, so is there an option to create that typed DataSet from the xsd or the xml file? I need many...
4
by: Rachana | last post by:
Hi, I have understood Data Sets but what is meant by typed/untyped/ strongly typed datasets. Can any one explain me or suggest any site/ article, to get these concepts (and their ...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.