Click here to Skip to main content
15,888,325 members
Home / Discussions / C#
   

C#

 
AnswerRe: splitter style Pin
Wendelius9-Sep-08 11:39
mentorWendelius9-Sep-08 11:39 
QuestionHowTo: Start a msi File in an Installation Pin
Ariadne9-Sep-08 9:19
Ariadne9-Sep-08 9:19 
AnswerRe: HowTo: Start a msi File in an Installation Pin
Manas Bhardwaj9-Sep-08 10:26
professionalManas Bhardwaj9-Sep-08 10:26 
GeneralRe: HowTo: Start a msi File in an Installation Pin
Ariadne9-Sep-08 10:58
Ariadne9-Sep-08 10:58 
Question[Message Deleted] Pin
bhatted9-Sep-08 7:53
bhatted9-Sep-08 7:53 
AnswerRe: collections Pin
Alan Balkany9-Sep-08 7:56
Alan Balkany9-Sep-08 7:56 
GeneralRe: collections Pin
bhatted9-Sep-08 8:14
bhatted9-Sep-08 8:14 
QuestionDatabase Update Error Pin
MumbleB9-Sep-08 6:02
MumbleB9-Sep-08 6:02 
Hi guys. I hope somebody can help me here. I am reading a file and checking a Database if the record exists, if the records exists I am updating the database with some other information. Now, this was working a few days ago but for strange reason it is not working now. Can somebody please have a look at the below?

foreach (GrpCombi grp in res)
{
    dataTable.Clear();
    dataAdapter = new OleDbDataAdapter("Select * From [Analysis] WHERE HOLDER_IDENTIFIER = '" + grp.AccountNo + "'", conn);
    OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(dataAdapter);
    dataAdapter.Fill(dataTable);

    if (dataTable.Rows.Count != 0)
    {
        MessageBox.Show(dataTable.Rows[rowPos]["HOLDER_IDENTIFIER"].ToString());
        dataTable.Rows[rowPos]["SapoBal"] = grp.AccountBal.TrimStart(myChar);
        dataAdapter.Update(dataTable);
        progressBar1.Invoke(new updatebar(this.UpdateGroupProgress));
    }

    else
    {
        sw.WriteLine(grp.AccountNo + "," + grp.AccountBal);
    }


The error I am getting is on the line dataAdapter.Update(dataTable);. The error message reads as follows:

System.InvalidOperationException was unhandled<br />
  Message="Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."<br />
  Source="System.Data"<br />
  StackTrace:<br />
       at System.Data.Common.DbDataAdapter.UpdatingRowStatusErrors(RowUpdatingEventArgs rowUpdatedEvent, DataRow dataRow)<br />
       at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)<br />
       at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)<br />
       at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)<br />
       at SasolDataAnalysis.Form1.GroupImport() in C:\Documents and Settings\Bernard\My Documents\Visual Studio 2005\Projects\SasolDataAnalysis\SasolDataAnalysis\Form1.cs:line 233<br />
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br />
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br />
       at System.Threading.ThreadHelper.ThreadStart()<br />


I added a message box to capture the record if it is found, which it does but when it does the updating it fails. Any hel;p would be greatly appreciated.

Cheers

Excellence is doing ordinary things extraordinarily well.

AnswerRe: Database Update Error Pin
Guffa9-Sep-08 6:04
Guffa9-Sep-08 6:04 
GeneralRe: Database Update Error Pin
MumbleB9-Sep-08 6:10
MumbleB9-Sep-08 6:10 
GeneralRe: Database Update Error Pin
Guffa9-Sep-08 10:38
Guffa9-Sep-08 10:38 
GeneralRe: Database Update Error Pin
MumbleB9-Sep-08 6:19
MumbleB9-Sep-08 6:19 
QuestionWOrd Automation Pin
burrows.stephen9-Sep-08 5:41
burrows.stephen9-Sep-08 5:41 
AnswerRe: WOrd Automation Pin
dan!sh 9-Sep-08 5:51
professional dan!sh 9-Sep-08 5:51 
GeneralRe: WOrd Automation Pin
burrows.stephen9-Sep-08 5:56
burrows.stephen9-Sep-08 5:56 
GeneralRe: WOrd Automation Pin
dan!sh 9-Sep-08 6:06
professional dan!sh 9-Sep-08 6:06 
GeneralRe: WOrd Automation Pin
burrows.stephen9-Sep-08 6:27
burrows.stephen9-Sep-08 6:27 
GeneralRe: WOrd Automation Pin
Dan Neely9-Sep-08 6:57
Dan Neely9-Sep-08 6:57 
GeneralRe: WOrd Automation Pin
dan!sh 9-Sep-08 9:05
professional dan!sh 9-Sep-08 9:05 
GeneralRe: WOrd Automation Pin
Dan Neely9-Sep-08 9:50
Dan Neely9-Sep-08 9:50 
GeneralRe: WOrd Automation Pin
vikas amin9-Sep-08 7:47
vikas amin9-Sep-08 7:47 
Questionhow can i draw a rectangle from a separate antoher winForm? Pin
maifs9-Sep-08 5:23
maifs9-Sep-08 5:23 
AnswerRe: how can i draw a rectangle from a separate antoher winForm? Pin
zafersavas9-Sep-08 5:49
zafersavas9-Sep-08 5:49 
AnswerRe: how can i draw a rectangle from a separate antoher winForm? Pin
DaveyM699-Sep-08 6:59
professionalDaveyM699-Sep-08 6:59 
QuestionValidating event in a Dialog form Pin
Gareth H9-Sep-08 5:21
Gareth H9-Sep-08 5:21 

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.