473,785 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dataset Updation

Hi Team,
I want to use DataSet in my ASP.Net application extensively.

Scenario is,
I am showing Data Set in one of my ASP.Net Page and changing row & column
values thru Page. After that I want to send this changed DataSet to Server
side and want to use "DataAdapter.Up date" to commit the change into
Database.

Is this possible ?

Please let me know with code.

Thanks in advance.

-Vinod
Nov 18 '05 #1
2 1162
Part of some of my classes (hope it'll give you a clue
where to go):

public static void UpdateDataTable (DataTable
dataTable,SqlCo nnection conn,string sql,params object[]
parameters)
{
SqlCommand comm = PrepareCommand
(conn,sql,param eters);
SqlDataAdapter da = new SqlDataAdapter( comm);
DataSet ds = new DataSet();
da.Fill(ds);
SqlCommandBuild er cb = new SqlCommandBuild er(da);
UpdateDataTable (ds.Tables[0],dataTable);
da.Update(ds.Ta bles[0]);
}
public static SqlCommand PrepareCommand( SqlConnection
connection,stri ng sql, params object[] parameters)
{
SqlCommand comm = PrepareCommand( sql,parameters) ;
if( connection.Stat e == ConnectionState .Closed )
connection.Open ();
comm.Connection = connection;
return comm;
}
public static SqlCommand PrepareCommand( string sql,params
object[] parameters)
{
SqlCommand comm = new SqlCommand(sql) ;
Regex re = new Regex
(@"(@\w+)",Rege xOptions.ECMASc ript);
MatchCollection mParams = re.Matches(sql) ;
for( int g=0; g < mParams.Count && g <
parameters.Leng th; g++ )
comm.Parameters .Add(mParams
[g].Value,paramete rs[g]==null?DBNull.V alue:parameters[g]);
return comm;
}
sql string is a select statement used to populate dataset
which gives that Table.

Regards.
-----Original Message-----
Hi Team,
I want to use DataSet in my ASP.Net application extensively.
Scenario is,
I am showing Data Set in one of my ASP.Net Page and changing row & columnvalues thru Page. After that I want to send this changed DataSet to Serverside and want to use "DataAdapter.Up date" to commit the change intoDatabase.

Is this possible ?

Please let me know with code.

Thanks in advance.

-Vinod
.

Nov 18 '05 #2
Hi Kikoz,

Thanks for the reply.

But I was looking for something else,

I repeat, I have a Dataset "DS1" in my ASP.Net page. Now I want to submit
back this Dataset to the Datalayer at Server side and Commit the Changes.
How I will make the dataadapter and attach to the dataset in this case as I
don't have the dataadapter which created to populate the dataset.

In windows applications, we used to send back the Dataset along with
Dataadapeter. How to do it in ASP.Net ?

If there is any alternative suggestions, let me know.

Thanks,

-Vinod


"Kikoz" <an*******@disc ussions.microso ft.com> wrote in message
news:04******** *************** *****@phx.gbl.. .
Part of some of my classes (hope it'll give you a clue
where to go):

public static void UpdateDataTable (DataTable
dataTable,SqlCo nnection conn,string sql,params object[]
parameters)
{
SqlCommand comm = PrepareCommand
(conn,sql,param eters);
SqlDataAdapter da = new SqlDataAdapter( comm);
DataSet ds = new DataSet();
da.Fill(ds);
SqlCommandBuild er cb = new SqlCommandBuild er(da);
UpdateDataTable (ds.Tables[0],dataTable);
da.Update(ds.Ta bles[0]);
}
public static SqlCommand PrepareCommand( SqlConnection
connection,stri ng sql, params object[] parameters)
{
SqlCommand comm = PrepareCommand( sql,parameters) ;
if( connection.Stat e == ConnectionState .Closed )
connection.Open ();
comm.Connection = connection;
return comm;
}
public static SqlCommand PrepareCommand( string sql,params
object[] parameters)
{
SqlCommand comm = new SqlCommand(sql) ;
Regex re = new Regex
(@"(@\w+)",Rege xOptions.ECMASc ript);
MatchCollection mParams = re.Matches(sql) ;
for( int g=0; g < mParams.Count && g <
parameters.Leng th; g++ )
comm.Parameters .Add(mParams
[g].Value,paramete rs[g]==null?DBNull.V alue:parameters[g]);
return comm;
}
sql string is a select statement used to populate dataset
which gives that Table.

Regards.
-----Original Message-----
Hi Team,
I want to use DataSet in my ASP.Net application

extensively.

Scenario is,
I am showing Data Set in one of my ASP.Net Page and

changing row & column
values thru Page. After that I want to send this changed

DataSet to Server
side and want to use "DataAdapter.Up date" to commit the

change into
Database.

Is this possible ?

Please let me know with code.

Thanks in advance.

-Vinod
.

Nov 18 '05 #3

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

Similar topics

2
12668
by: Mojtaba Faridzad | last post by:
Hi, Please check these lines: DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet, "mytable"); DataRow row; row = dataSet.Tables.Rows; row.BeginEdit(); row = "555";
0
1078
by: Lakshmi Narayanan.R | last post by:
Hi Experts I am new to .NET. I need great explanation for "the updation in the disconnected data". How it is handled. That is, if mutiple user is interacting with the data, one will delete another will insert or update. So after the modifications how the correct updation is made in the database table. What the hidden mechanism is there. The updation logic is confusing Pls help me, if any articles available let me know them Thanks in...
16
2783
by: Vibhu | last post by:
Hello All, I am trying to update a database using dataset but seems that I am missing out something. After going through a lot of posts and checking my code, I am still at my wits end to figure out how to do a simple update. Here is the code. Any help would be greatly appreciated. Regards,
0
1297
by: prashant | last post by:
Hi, I am trying to set up Transactional replication with immediate updation. The configuration is as follows: 1. Publisher is SQL server 2000 Enterprise Edition, and Distributor is on the same server. 2. Publisher SQL server is installed on Windows 2003.
4
1350
by: m.ra. via DotNetMonster.com | last post by:
hi. ive been using a certain code for updating information from a windows form to an Access database , and it was handling the addition of new information properly until now. now suddenly the dataset seems to be reordering the rows in an arbitrary fashion, and since i use ds.tables("form1").rows(ctr-1).item(*column name*)
1
1966
by: batista | last post by:
Hello all, I have a third praty grid control...named C1grid. Im using it in one of my apps.. Now, I have bind this grid to a custom dataset class named "DataViewEx". The code of the class is below... Now what happens is that im updating this dataviewex class from a separate thread.....
0
1099
by: smasadhaque | last post by:
We are using a third party control C1FlexGrid to display the real time data. The data is received from a server on a different thread, processed and then stored in a dataset table. This table is binded to the C1FlexGrid via an extended DataView that calls BeginInvoke whenever the data is updated to update the grid (GUI thread). The problem is that this whole process is taking too much time. Many time the user complains that the message...
0
1068
by: shamaila | last post by:
i m using dataadapter to handle dataset..the date is shown in the datagrid..now i want to update the records edited by the user i have used one button to show the records,(in which i hv declared dataadapters and dataset) and behind "edit record" button i want to write the code for updation if i use the command DataAdapter.Update(Dataset); what should i do as the dataadpter and dataset are declared behind the other button??
1
1684
by: siri11 | last post by:
Hi everyone!!!!!!!!! If i update a record in a table in sqlserver from front end (c#.net),using a stored procedure for updating then after updation if i open the table then it is showing the same record 2 times i.e before updation record and after updation record..Plzzzzzzzz help me how to solve this problem....its very urgent...Plzzzzzzzzzz Thanks in advance siri
0
9645
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
10327
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
10151
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
9950
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...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
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
5381
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.