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

adapter.Update method

Hi i am using a dataset to update a table in database.

I am using a loop to insert multiple records in the dataset.The dataset gets updated perfectly in the dataset.But when i call the adapter.update method
i.e. adap.Update(ds,"table")

only the last record gets added n times.... I don know wats happening there..

Can anyone help me???

Thanks
Santhosh.

This is my code:
FOR LOOP{
adap.InsertCommand = new SqlCommand("INSERT INTO SAN_PB_BAL_GRP VALUES('" + bal_name + "','" + eq_name + "')", conn);

DataRow newrow = ds.Tables["temp_table"].NewRow();
newrow[0] = bal_name;
newrow[1] = eq_name;
ds.Tables["temp_table"].Rows.Add(newrow);
}//END OF FOR LOOP

adap.Update(ds, "temp_table");
Apr 3 '07 #1
1 1917
Hi i am using a dataset to update a table in database.

I am using a loop to insert multiple records in the dataset.The dataset gets updated perfectly in the dataset.But when i call the adapter.update method
i.e. adap.Update(ds,"table")

only the last record gets added n times.... I don know wats happening there..

Can anyone help me???

Thanks
Santhosh.

This is my code:
FOR LOOP{
adap.InsertCommand = new SqlCommand("INSERT INTO SAN_PB_BAL_GRP VALUES('" + bal_name + "','" + eq_name + "')", conn);

DataRow newrow = ds.Tables["temp_table"].NewRow();
newrow[0] = bal_name;
newrow[1] = eq_name;
ds.Tables["temp_table"].Rows.Add(newrow);
}//END OF FOR LOOP

adap.Update(ds, "temp_table");









Hi,

From my knowlegde, The problem will be with the variables.

bal_name

eq_name

... The value is not updating. Please check that.
Apr 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: compuglobalhypermeganetz0r | last post by:
I am having trouble getting an adapter to update my access database, it gives the error Syntax error in INSERT INTO statement. for Line 98: Adapter.Update(WineDS, "tblWines") Below is my...
1
by: | last post by:
I will be add Data in my Example Database. I have this Code by a ASP.NET Book but this will not work. Error message: Operation must be a actually Query use. Error in:...
8
by: rriness | last post by:
I'm getting an inconsistent failure when trying to save data in ADO.Net. I'm using an Access database with a simple query - SELECT StudentID, FirstName, LastName FROM Students - and have no...
7
by: GatorBait | last post by:
Hi all, I am having a problem with my data adapter update command. I have generated the data adapter in the IDE and then I built a dataset. The dataset can get changed in the program and I...
2
by: Zorpiedoman | last post by:
Up to this point, I have avoided using the Data Adapter to do my updates back to the database. I found it more straight forward to build my own SQL statements, and just execute them directly. ...
1
by: Adam | last post by:
This is kind of a tough question, but, I'm working on a program now and using sql data adapters with sql server to generate data tables. I'm updating the tables and then using the...
1
by: cindy | last post by:
this is the call private void Page_Load(object sender, System.EventArgs e) { OdbcConnection connection = new OdbcConnection ("DSN=PFW52"); CreateDataAdapter(connection); } this is the code,...
0
by: mwenz | last post by:
I am trying to update an Access table using OLEDB in VB.Net 2005. I can add rows but I cannot update them. Code to instantiate the Access database and table... Dim conn As New...
6
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.