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

Help!! dataadapter.update(dataset,table) is either throwing errors or not updating?

here is my code..

Expand|Select|Wrap|Line Numbers
  1.  
  2.  private void button2_Click(object sender, EventArgs e)
  3.         {
  4.  
  5.             String str1 = "select * from table1";
  6.             dad1 = new SqlDataAdapter(str1, con);
  7.             dad1.Fill(ds,"table1");
  8.  
  9.         SqlCommandBuilder cmdbuild = new SqlCommandBuilder(dad1);      
  10.  
  11.             DataRow drow2 = ds.Tables["table1"].NewRow();
  12.  
  13.             drow2[1] = "chop";
  14.             drow2[2] = 10;
  15.  
  16.             ds.Tables["table1"].Rows.Add(drow2);
  17.  
  18.             dad1.Update(ds,"table1");
  19.  
  20.             MessageBox.Show("done");
  21.         }
  22.  
i am a new bee and would very much appreciate your help because i am able to retrieve information but not insert any row nor update any row.. when i run the program either it throws errors like update() parameters is wrong, or, it does not throw any error (executing the messagebox command )but when i check my database table, i find my table not updated!!!!

PS: i checked the dataset designer for my table and it had an sql query Fill,Getdata(), so i added another called insertquery() but then i am not able to figure out how to access this query from the form!!!
Apr 20 '11 #1
0 963

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

Similar topics

0
by: Simon Riggs | last post by:
I'm trying to create some User Defined Functions, which act as scalar functions. I can successfully create a UDF like this: drop function arraylistset; CREATE FUNCTION ArrayListSet (ArrayList...
6
by: Bernd Koehler | last post by:
Hi: I am a EE prof currently teaching an IT course. One the assignments students recently completed was designing a small MS Access Database. I have two submissions that are remarkably...
21
by: Dan | last post by:
Hi, just ran into my first instance of a backend Access97 database not compacting. I'm getting the "MSACCESS.EXE has generated errors.." message on compact. I've narrowed it down to the largest...
3
by: Richard Holliingsworth | last post by:
Hello: Thanks for reading this post. I have (had) a relatively small table of about 12 fields that has now bloomed into a monster of 38 fields and could get bigger. It's way past time to...
9
by: baonks | last post by:
hello all here is my problem: I have 2 table 1: K_POS SALDO_A_D SALDO_A_K 11100 105 5 11200 5 105
3
by: Roger Withnell | last post by:
I have a framed website. I plan to include in default.asp a routine to check if the annual subscription is due from the records in the People table. If so, then the routine would send emails...
3
by: Baheri | last post by:
Can some some guide me to a good link on how to throw errors in a webservice? Also if there is a standard way of defining different degress of erros while exposing your webservice to thrid parties?...
8
by: Ruben | last post by:
Hello I'm struggling with the throw and catch exception system. As I understood it, when you throw an error, that the stack is searched for a matching catch, but I'm having difficult finding...
5
by: Stepheno | last post by:
Hi, I am a recently converted Iseries (AS/400) RPG programmer trying to learn HTML/CSS/JavsScript all at the same time (not fun). My problem deals mostly with CSS. I will be reveiving a table,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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?
0
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,...
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,...

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.