Click here to Skip to main content
15,909,898 members
Home / Discussions / Database
   

Database

 
AnswerRe: Sql server 2000 Pin
enjoycrack19-May-07 6:14
enjoycrack19-May-07 6:14 
QuestionSQL Server Internal Commands Pin
Werries18-May-07 6:14
Werries18-May-07 6:14 
AnswerRe: SQL Server Internal Commands Pin
dhbaer18-May-07 7:13
dhbaer18-May-07 7:13 
GeneralRe: SQL Server Internal Commands Pin
Giorgi Dalakishvili18-May-07 7:33
mentorGiorgi Dalakishvili18-May-07 7:33 
GeneralRe: SQL Server Internal Commands Pin
Werries19-May-07 19:40
Werries19-May-07 19:40 
Questiondatabase connection through proxy server Pin
sridhar vattam18-May-07 2:33
sridhar vattam18-May-07 2:33 
AnswerRe: database connection through proxy server Pin
dhbaer18-May-07 7:14
dhbaer18-May-07 7:14 
QuestionDataGridView databound DataTable wont update? [modified] Pin
MrRhino18-May-07 1:43
MrRhino18-May-07 1:43 
Hi There,

Im having problems making a simple datagridview update.
The datagridview is bound to a dataset.

The three posted examples are in C# and are made in VS 2005 Express.
Im not recieving any errors and i can see the changed records being passed in all three examples when debugging.
Everything looks fine, except that the database is not updated?
Furthermore, i have made sure that the update commands ok.
Which means that the commands are present and does not contain joins.
Refresh table has also been cheched on in the table adapter configuration.

This is supposed to be dead easy..b1"#ch wine moan Cry | :(( ...

Here is my examples:

Could someone please give me a clue to what im doing wrong?
Thanks.


//Update method1
//
private void btnSave_Click(object sender, EventArgs e)
{
myDataGridView.BindingContext[myDataSet.myDataTable].EndCurrentEdit();

DataSetType.DataTableType myChangedRows = (DataSetType.DataTableType)myDataSet.myDataTable.GetChanges();
if (myChangedRows != null)
{
myTableAdapter.Update(myChangedRows); //myChangedRows as DataSetType.DataTableType
myDataSet.myDataTable.AcceptChanges();
}
}

//Update method2
//
private void btnSave_Click(object sender, EventArgs e)
{
myDataGridView.BindingContext[myDataSet.myDataTable].EndCurrentEdit();

if (myChangedRows != null)
{
for (int i = 0; i < myChangedRows.Rows.Count; i++)
{
//Using custom SQL-Comand UpdateRow
myTableAdapter.UpdateRow((int)myChangedRows.Rows[i].ItemArray.GetValue(0), ((Guid)myChangedRows.Rows[i].ItemArray.GetValue(4)));
}
myDataSet.myDataTable.AcceptChanges();
}
}

//Update metohod3
//
private void btnSave_Click(object sender, EventArgs e)
{
myDataGridView.BindingContext[myDataSet.myDataTable].EndCurrentEdit();

if (myDataSet.HasChanges())
{
DataRow[] myChangedRows = (DataSetType.DataTableType)myDataSet.myDataTable.GetChanges();
myTableAdapter.Update(myChangedRows); //myChangedRows as array of DataRow
myDataSet.myDataTable.AcceptChanges();
}
}



-- modified at 14:37 Friday 18th May, 2007
AnswerRe: DataGridView databound DataTable wont update? Pin
MrRhino20-May-07 0:35
MrRhino20-May-07 0:35 
QuestionNull Reference Exception in Grid View? Pin
chand1017-May-07 23:54
chand1017-May-07 23:54 
AnswerRe: Null Reference Exception in Grid View? Pin
kubben18-May-07 2:27
kubben18-May-07 2:27 
QuestionThis Procedure Does not Add a new record in the Table Help Pin
Vimalsoft(Pty) Ltd17-May-07 23:46
professionalVimalsoft(Pty) Ltd17-May-07 23:46 
AnswerRe: This Procedure Does not Add a new record in the Table Help Pin
Pete O'Hanlon17-May-07 23:54
mvePete O'Hanlon17-May-07 23:54 
GeneralRe: This Procedure Does not Add a new record in the Table Help Pin
Vimalsoft(Pty) Ltd18-May-07 0:32
professionalVimalsoft(Pty) Ltd18-May-07 0:32 
GeneralRe: This Procedure Does not Add a new record in the Table Help Pin
Pete O'Hanlon18-May-07 1:13
mvePete O'Hanlon18-May-07 1:13 
GeneralRe: This Procedure Does not Add a new record in the Table Help Pin
Vimalsoft(Pty) Ltd18-May-07 1:28
professionalVimalsoft(Pty) Ltd18-May-07 1:28 
GeneralRe: This Procedure Does not Add a new record in the Table Help Pin
Pete O'Hanlon18-May-07 2:02
mvePete O'Hanlon18-May-07 2:02 
GeneralRe: This Procedure Does not Add a new record in the Table Help Pin
Vimalsoft(Pty) Ltd18-May-07 3:05
professionalVimalsoft(Pty) Ltd18-May-07 3:05 
QuestionWindows Authentication in SQL Server 2005 Pin
ragavan17-May-07 23:16
ragavan17-May-07 23:16 
AnswerRe: Windows Authentication in SQL Server 2005 Pin
Mike Dimmick18-May-07 4:28
Mike Dimmick18-May-07 4:28 
QuestionImport and Export Pin
.NET- India 17-May-07 22:34
.NET- India 17-May-07 22:34 
AnswerRe: Import and Export Pin
gauthee17-May-07 23:39
gauthee17-May-07 23:39 
QuestionSQL Analysis Pin
samerh17-May-07 20:54
samerh17-May-07 20:54 
AnswerRe: SQL Analysis Pin
Pete O'Hanlon17-May-07 23:59
mvePete O'Hanlon17-May-07 23:59 
QuestionConvert Access Database to SQL Database Pin
Werries17-May-07 20:35
Werries17-May-07 20:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.