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

problem with updating records from datagrid

i m editing records through datagrid..behind my update button i've written following code..

String str = " ";
for (int i = 0; i == editgrid.RowCount - 1; i++)
{
str = "UPDATE criminal SET cr_id = " + editgrid.Rows[i].Cells[1].Value + ", cr_name= '" + editgrid.Rows[i].Cells[2].Value + "', cr_desc='" + editgrid.Rows[i].Cells[3].Value + "' ,cr_pic= '" + editgrid.Rows[i].Cells[4].Value + "', no_times ='" + editgrid.Rows[i].Cells[5].Value + "' WHERE cr_id = " + editgrid.Rows[i].Cells[1].Value;
SqlCommand com = new SqlCommand(str, conn);
com.ExecuteNonQuery();
label2.Visible = true;

}
it is not giving any errors but records are not updated,yet
can anybody help me??
Jul 27 '07 #1
1 955
kenobewan
4,871 Expert 4TB
Write out the values and check db values.
Jul 27 '07 #2

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

Similar topics

5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
4
by: Reney | last post by:
I have a very weird problem in updating my datagrid. Please help me to solve it. The datagrid is tied to a dataset table with five columns. Three of them are primary key and the other two columns...
1
by: TM | last post by:
I have a problem with the datagrid where I wanted to detect any changes to the grid, such as a record being changed, added or deleted. So I used the currentcellchanged method and used the code...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
1
by: pete matthews | last post by:
HI. I have a dataset with two tables. Table 1 is parent and table 2 is child. Am populating a single datagrid with records from child table derived from a single parent record. I am then allowing...
2
by: susan.f.barrett | last post by:
Hi, Despite me being able to type the following in to SQL Server and it updating 1 row: > updatestockcategory 1093, 839 In my code, it is not updating any rows. dataSet = new DataSet();
6
by: Bernie Hunt | last post by:
I have a simple app that grabs records from a database and steps through them processing each record. I have three text fields on the form to give the user feedback on the progress. With each...
1
by: Erland | last post by:
Hi all, I have created a simple database table in ACCESS named as "Users" that contains only two fields "UserID" ( Primary key )and "Password". I am having problems while UPDATING the records in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.