473,386 Members | 1,720 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.

DataGrid Updates

Hello,

I'm not sure if this is the right forum for this but I'm having a great
difficulty in updating my datagrid. Basically, I have run the debugger and
it seems as though the new value I type in for the field "password" isn't
captured. I'm posting the code for the update portion and will appreciate
any help.

Thank you
Mike

private void DataGrid1_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string ItemIndex =
DataGrid1.DataKeys[(int)e.Item.ItemIndex].ToString();

TextBox tb;
tb = (TextBox)(e.Item.Cells[3].Controls[0]);
string password = tb.Text;

SqlConnection conn = new SqlConnection(strConn);
SqlCommand cmd = new SqlCommand(update, conn);

cmd.Parameters.Add(new SqlParameter("@Username", SqlDbType.NVarChar,
20));
cmd.Parameters["@Username"].Value =
DataGrid1.DataKeys[(int)e.Item.ItemIndex];
cmd.Parameters.Add("@Password",password);
try
{
conn.Open();
cmd.ExecuteNonQuery();
DataGrid1.EditItemIndex = -1;
}
finally
{
conn.Close();
}
DataGrid1.DataBind();
}
Nov 16 '05 #1
0 824

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

Similar topics

2
by: Stephan Steiner | last post by:
Hi I'm using several DataTables in my program which are updated periodically. At the same I have those tables bound to DataGrids in my GUI. So far I've been doing all the processing in the same...
0
by: Raed Sawalha | last post by:
Hello: I have windows application that do monitoring task, there is a thread continously running to check updates made on XML file then updates the datagrid information with new information as...
5
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. ...
1
by: AA | last post by:
We want to edit, update data of DataGrid in Asp.Net with VB.Net.and are writing the following code for EditCommand and UpdateCommand Event is : DataGrid1_EditCommand
2
by: Raed Sawalha | last post by:
Dear: I have DataGrid , which its task to (Edit, update, and delete) contents of XML File. the structure of XML like this <Info> <Name></Name> <Age></Age>
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
2
by: shumaker | last post by:
I did have a save button for a datagrid that is bound to a tableadapter, but I wanted to remove the button and instead save updates everytime a user finishes editing a row. So I moved the update...
4
by: Abby | last post by:
Hi all, I have a datagrid which i am using for updating the data to the database. It works fine for single row data however when i have multiple rows(records) associated with the same...
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
4
by: Ty | last post by:
Hi all Short version of my problem: i have a Datagrid (Flexgrid from ComponentOne) with a Datatable as source. I need to search a row in the datatable, using a primary key column in the...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.