473,231 Members | 1,703 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,231 software developers and data experts.

Re: DataSets and default columns

Steven

Thanks for your reply, however the typed datasets are defined in the web
service and there seems to way to open the partial class code window -
double clicking on the design surface does nothing. I can do this in the
client for a client specific dataset, but not in the web service.

--
Best regards
Mark Baldwin

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:qo**************@TK2MSFTNGHUB02.phx.gbl...
Hi Mark,

Based on your description, I understand that you have some Typed
DataSet/DataTables generated from database and will be transferred between
client and server through webservice. However, one of the table column is
set to AllowNull= false while you will need it be set to "true" when using
it at client or server code, correct?

As for the auto-generated typed-dataset, when you reconfigure it from
database, it does overwrite the original one therefore, if we manually
make
any changes on the dataset/table adapter, it will be changed after we
update it from database. Also, I can understand your concern that it's
better to keep data access code away from UI layer.

Currently I think we still need to write some custom code to set the
"AllowNull" property. However, to prevent the code from being overwrite
when update dataset or not coupled with UI layer, you may consider the
following approach:

**In .NET 2.0, auto-generated typed dataset/datatables use parital
classes.
Thus, you can also add another partial class file to extend the certain
typed DataSet or DataTable(and its TableAdapter).

#Extending Typed DataSets - Sorting Child Rows
http://www.madprops.org/cs/blogs/mab...ets-sorting-ch
ild-rows.aspx

You can add some custom method for the TableAdapter (which change the
AllowNull property of the certain DataTable or use your own SqlCommand
object for updating, inserting). You encapsulate all these code logic in a
single custom method.

e.g.

===============
public partial class personsDataTable {

private global::System.Data.DataColumn columnid;
private global::System.Data.DataColumn columnname;
...

public MyInit()
{
this.columnname.AllowDBNull = true;
}
..
=============
** In your actual code(in client or server application) which use this
TypedDataSet, you can simply call the custom function you defined above(at
the begining when you create an instance of that datatable). Though it
still require you to manually call the method, it reduce much data access
specific code.

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
From: "Mark Baldwin" <sW*****@community.nospam>
Subject: DataSets and default columns
Date: Wed, 9 Apr 2008 14:56:59 +0100

We have a 3 tiered application. Table <tblxresides in SQL2005, the
DataSet
<dsxis defined in the web service. The client creates instances of <dsx>
and passes them to the web service for storage/processing.

The table <tblxhas a column "EntryDate" with a default value of
"CURRENT_TIMESTAMP". When the DataSet <dsxis generated from the table,
the
EntryDate column is set to AllowNulls=false and the INSERT statement in
the
TableAdapter includes the EntryDate column.

Before I can use this DataSet I have to change AllowNulls to true,
otherwise
this column has to be filled in by the client before it can be sent the
DataSet to the WebService. I also have to change the TableAdapters INSERT
statement so as not to include the EntryDate column - since its
automatically populated by SQLServer.

This isn't too much of a problem, but everytime I modify the table
structure
I have to remember to do these two things after refreshing the DataSet and
to be honest it's becoming a bit long in the tooth.

Is there a way around these problems? I know I can set the EntryDate
column
in the table to AllowNulls but I don't want to do this, it's just not good
practise to allow UI problems to be solved in the data layer.

--
Best regards
Mark

Jun 27 '08 #1
1 1754
Thanks for your reply Mark,

Yes, when you use the "WebSite" project model for ASP.NET 2.0+ Web
application/webservice, it use a dynamic compilation mode. Thus, some
components such as Typed Dataset, webservice proxy will not show the
auto-generated code file. For such scenario, a common approach is move the
Typed Dataset into a class library project. Thus, you can add partial class
file for the typed dataset in the class library project. And in your
ASP.NET webservice project, you can reference the class library assembly to
use the typed Dataset. Do you think it workable for your scenario?

If there is any further questions, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Mark Baldwin" <sW*****@community.nospam>
References: <O2**************@TK2MSFTNGP06.phx.gbl>
<qo**************@TK2MSFTNGHUB02.phx.gbl>
Subject: Re: DataSets and default columns
Date: Mon, 14 Apr 2008 11:38:38 +0100

Steven

Thanks for your reply, however the typed datasets are defined in the web
service and there seems to way to open the partial class code window -
double clicking on the design surface does nothing. I can do this in the
client for a client specific dataset, but not in the web service.

--
Best regards
Mark Baldwin

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:qo**************@TK2MSFTNGHUB02.phx.gbl...
Hi Mark,

Based on your description, I understand that you have some Typed
DataSet/DataTables generated from database and will be transferred between
client and server through webservice. However, one of the table column is
set to AllowNull= false while you will need it be set to "true" when using
it at client or server code, correct?

As for the auto-generated typed-dataset, when you reconfigure it from
database, it does overwrite the original one therefore, if we manually
make
any changes on the dataset/table adapter, it will be changed after we
update it from database. Also, I can understand your concern that it's
better to keep data access code away from UI layer.

Currently I think we still need to write some custom code to set the
"AllowNull" property. However, to prevent the code from being overwrite
when update dataset or not coupled with UI layer, you may consider the
following approach:

**In .NET 2.0, auto-generated typed dataset/datatables use parital
classes.
Thus, you can also add another partial class file to extend the certain
typed DataSet or DataTable(and its TableAdapter).

#Extending Typed DataSets - Sorting Child Rows
http://www.madprops.org/cs/blogs/mab...ets-sorting-ch
ild-rows.aspx

You can add some custom method for the TableAdapter (which change the
AllowNull property of the certain DataTable or use your own SqlCommand
object for updating, inserting). You encapsulate all these code logic in a
single custom method.

e.g.

===============
public partial class personsDataTable {

private global::System.Data.DataColumn columnid;
private global::System.Data.DataColumn columnname;
...

public MyInit()
{
this.columnname.AllowDBNull = true;
}
..
=============
** In your actual code(in client or server application) which use this
TypedDataSet, you can simply call the custom function you defined above(at
the begining when you create an instance of that datatable). Though it
still require you to manually call the method, it reduce much data access
specific code.

How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no
rights.


--------------------
From: "Mark Baldwin" <sW*****@community.nospam>
Subject: DataSets and default columns
Date: Wed, 9 Apr 2008 14:56:59 +0100

We have a 3 tiered application. Table <tblxresides in SQL2005, the
DataSet
<dsxis defined in the web service. The client creates instances of <dsx>
and passes them to the web service for storage/processing.

The table <tblxhas a column "EntryDate" with a default value of
"CURRENT_TIMESTAMP". When the DataSet <dsxis generated from the table,
the
EntryDate column is set to AllowNulls=false and the INSERT statement in
the
TableAdapter includes the EntryDate column.

Before I can use this DataSet I have to change AllowNulls to true,
otherwise
this column has to be filled in by the client before it can be sent the
DataSet to the WebService. I also have to change the TableAdapters INSERT
statement so as not to include the EntryDate column - since its
automatically populated by SQLServer.

This isn't too much of a problem, but everytime I modify the table
structure
I have to remember to do these two things after refreshing the DataSet and
to be honest it's becoming a bit long in the tooth.

Is there a way around these problems? I know I can set the EntryDate
column
in the table to AllowNulls but I don't want to do this, it's just not good
practise to allow UI problems to be solved in the data layer.

--
Best regards
Mark


Jun 27 '08 #2

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

Similar topics

2
by: Dan Cooper | last post by:
I've got two datasets, each containing a single data table. dstDataSetA.Tables("TableA") dstDataSetB.Tables("TableB") I want to merge them together and delete any non-matching rows. ...
19
by: Will Lastname | last post by:
In one of the applications that I'm working on I have 2 sets of functions that build different datasets. Imagine 4 columns in a datagrid. Inside those 4 columns I have nested datalists. Two of...
7
by: Przemo | last post by:
Hi, I wonder about performerce comparision between these two types of DataSets. Are benefits of typed DataSets enought to beat speed of untyped ones? Or it doesn't matter? What do you think? ...
1
by: tg.foobar | last post by:
my setup: visual studio 2005 sql server 2000 i'm using a dataset (used to be called typed dataset in 2003), where i use the MSDataSetGenerator to create a class for me based on the scheme of...
4
by: Frank | last post by:
Hello, Developing an app where the user fills out a sometimes quite lengthy form of chkboxes, txtboxes, radbtns, etc. User responses are saved to a mySql db, which the user can later edit. When...
2
by: Dave | last post by:
We've created a robust client server application over the past 3 years on the .NET framework version 1.1 using c#. We layed all of our marbles in creating strongly typed datasets and for the most...
3
by: Dave | last post by:
We've created a robust client server application over the past 3 years on the .NET framework version 1.1 using c#. We layed all of our marbles in creating strongly typed datasets and for the most...
7
by: Ryan | last post by:
I'm in the process of learning more about building my ASP.NET website to use my SQL datastore and am a bit confused about how ADO.NET works with ASP.NET. This Microsoft article implies that using...
7
by: Ryan | last post by:
Quite awile ago I posted to this newsgroup in regards to using Datasets in my VB 2005 application. About how many Datasets should be used.. a limit to the number of tables that should be included...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.