473,763 Members | 7,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Typed Dataset and IDbDataAdapter

I am trying to get dataset working through IDbDataAdapter interface as
my solution need to work with Sql Server and Oracle ODP. I am using
different data provider factories and the code here only shows SQL
Server.

My code snippets are

// Build the interface in provider factory (_pf in code below)
public IDbDataAdapter CreateDataAdapt er()
{
return (IDbDataAdapter ) new SqlDataAdapter( );
}
....
Instantiate the class using reflection depending upon data provider
factory selection through web.config

//
....
public IDbDataAdapter DataAdapter = null;

public void prepareDataSet( string SQL)
{
connect();
DataAdapter = _pf.CreateDataA dapter();
DataAdapter.Sel ectCommand = _pf.CreateComma nd(SQL,_connect ion);
}

I use this method from data access layer class to fill the dataset.

public DataSet GetContactAuth( DataSet ds)
{
string sql = "SELECT * FROM contact_auth";
db.prepareDataS et(sql);
db.DataAdapter. Fill(ds);
return ds;
}

I call this method from my business layer

public DatasetContactA uth execute(string userName, string password)
{
DatasetContactA uth dsLogin = null;
try
{
connectToDb();
ContactDAL dal = new ContactDAL(getD b());
dsLogin = (DatasetContact Auth) dal.GetContactA uth(new
DatasetContactA uth());
disconnectFromD b();
}
catch(Exception e)
{
ExceptionManage r.Publish(e);
this.ErrorMsg = "Error in getting Contact information. Please
contact your system administrator." ;
}
return dsLogin;
}

The Problem :

If I use typed dataset and use direct SQLClient API then I have to use
Fill(ds,"Table_ name") to fill the dataset. Fill(ds) alone does not
work.

The IDbDataAdapter interface has only one overloaded method of Fill as
against 7 or more available in DBDataAdapter in System.Data.Com mon.

I am at loss to figure this out. Is there something, you can point out
to help me.

My requirements:

1. I have to use typed datasets. Weak datasets are not an option.
2. I have to use Interfaces to make code work with different data
providers.

How do I fill my typed dataset under this condition using
IDbDataAdapter interface.

I am new to .net so please pardon my ignorance.

I appreciate your help.

-Regards.
Nov 22 '05 #1
2 3926
Hi,
The Problem :

If I use typed dataset and use direct SQLClient API then I have to use
Fill(ds,"Table_ name") to fill the dataset. Fill(ds) alone does not
work.
It works, but if probably fills another table (based on select from).
Either use that or pass DataTable directly to Fill.
The IDbDataAdapter interface has only one overloaded method of Fill as
against 7 or more available in DBDataAdapter in System.Data.Com mon.

I am at loss to figure this out. Is there something, you can point out
to help me.

My requirements:

1. I have to use typed datasets. Weak datasets are not an option.
2. I have to use Interfaces to make code work with different data
providers.

How do I fill my typed dataset under this condition using
IDbDataAdapter interface.


Every adapter is derived from DbDataAdapter.
So, you might just cast to DbDataAdapter or use DbDataAdapter instead of
IDbDataAdapter. ..

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rthand.com
Nov 22 '05 #2
"Miha Markic" <miha at rthand com> wrote in message
It works, but if probably fills another table (based on select from).
Either use that or pass DataTable directly to Fill.
You were right. The fill created a table name called "Table" and this
"table" got added in addition to one that was already there. - Thanks
Every adapter is derived from DbDataAdapter.
So, you might just cast to DbDataAdapter or use DbDataAdapter instead ofIDbDataAdapter ...


I used this and then used overloaded method of fill(ds,"CONTAC T_AUTH")
and it worked. - Thanks
Nov 22 '05 #3

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

Similar topics

2
403
by: Vaap | last post by:
I am trying to get dataset working through IDbDataAdapter interface as my solution need to work with Sql Server and Oracle ODP. I am using different data provider factories and the code here only shows SQL Server. My code snippets are // Build the interface in provider factory (_pf in code below) public IDbDataAdapter CreateDataAdapter() {
1
6089
by: Job Lot | last post by:
I am confused how strongly typed dataset is different from un-typed dataset. Is there any good link explaining pros and cons of both? Which one should be used preferably?
1
1720
by: Nedu N | last post by:
Hi All, I am facing problem in copying content of table from a untyped dataset into to a table inside the typed dataset. I wanted to copy the data into typed dataset in order to ease the further processing using typed references. DataSet ds = getDataFromDB(); - i am getting the dataset ds from a webservice I have got MyXSD which decsribes the shcema for the table which i am getting from the webservice
4
18285
by: N. Okan Guney | last post by:
Hello, How could I read just one cell out of a dataset? I have a query returing a 3 x 3 table. a b c d e f x y z
0
1007
by: Shapper | last post by:
Hello, I have a dataset in an ASP.NET/VB web site. Here is the aspx code:
3
2761
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong typed properties from my original dataset Anyone that can point me to an example of how to sort my dataset and maintain the use of my typed properties would be greatly appreciated Thank, Freeon
1
9362
by: Optimus | last post by:
Hi everyone, I currently develop an application in vs.net 2005 with vb.net. I was trying to use typed dataset and I've got in trouble for converting untyped dataset into Typed DataSet. I don't know why I cannot perform this casting operation properly. First off, I've got my Typed DataSet named "AuthInfo" declared and I then created an instance of that class. What I'd like to do next is to perform querying through the method...
4
9923
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... code gen, code gen, code gen. What's at the end looks slick, but then there's a ton of generated code that I'm going to have to maintain now. I.e. I like typing things myself (don't like wizards) so I can know exactly what I've done.
21
2431
by: Peter Bradley | last post by:
Hi all, This post is sort of tangentially related to my earlier posts on configuration files for DLLs. Does anyone know how to create typed DataSets using VS2005's new DataSet designer, but with the ability to configure the connection string via a config file? The designer seems to hard-code the connection string into the dataset itself, which just can't be right.
4
3112
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 comparisions) cleared? Thanks, Rachana
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10144
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.