Click here to Skip to main content
15,899,754 members
Home / Discussions / C#
   

C#

 
AnswerRe: UpperBound of Dynamic array Pin
OriginalGriff29-Jul-10 23:43
mveOriginalGriff29-Jul-10 23:43 
GeneralRe: UpperBound of Dynamic array Pin
riced30-Jul-10 0:29
riced30-Jul-10 0:29 
GeneralRe: UpperBound of Dynamic array Pin
OriginalGriff30-Jul-10 0:33
mveOriginalGriff30-Jul-10 0:33 
GeneralRe: UpperBound of Dynamic array Pin
Keith Barrow30-Jul-10 0:49
professionalKeith Barrow30-Jul-10 0:49 
GeneralRe: UpperBound of Dynamic array Pin
Enobong Adahada2-Aug-10 8:11
Enobong Adahada2-Aug-10 8:11 
AnswerRe: UpperBound of Dynamic array Pin
PIEBALDconsult30-Jul-10 6:08
mvePIEBALDconsult30-Jul-10 6:08 
GeneralRe: UpperBound of Dynamic array Pin
riced30-Jul-10 6:11
riced30-Jul-10 6:11 
QuestionProblem updating data in an MSSQL database Pin
aneuby29-Jul-10 21:57
aneuby29-Jul-10 21:57 
Hi everyone,

I have the following issue. I use the following code to retrieve all data row from an mssql database and during the process I update some values.
The issue I have is that it only updates the first row in the database. All other rows which should be updated (field: WEB_OBEZ,...) are NULL.

Does someone have an idea or can explain why it only updates the first row ?

Thank you very much!

        private string FixOBez()
        {
            SqlConnection dbconn = new SqlConnection(this.sqlconn);

            try
            {
                dbconn.Open();

                SqlDataReader sqlreader = null;
                SqlCommand mycmd = new SqlCommand("SELECT * FROM dbo.testdata", dbconn);
                sqlreader = mycmd.ExecuteReader();

                // Wo kein leerzeichen ist muss eins eingefügt werden
                while (sqlreader.Read())
                {
                    string obez = sqlreader["O_BEZ"].ToString();
                    string okuerzel = sqlreader["O_KURZ"].ToString();

                    // Neue Bezeichnung holen
                    string[] lines = GetNewOBez(obez);


                    // Neue Bezeichnung schreiben
                    SqlCommand sql2 = new SqlCommand("UPDATE dbo.testdata SET WEB_OBEZ1 = '" + lines[0] + "',WEB_OBEZ2 = '" + lines[1] + "',WEB_OBEZ3 = '" + lines[2] + "' WHERE O_KURZ = '" + okuerzel + "'",dbconn);
                    sql2.ExecuteNonQuery();

                    return "OK";
                }

            }
            catch (Exception ex)
            {
                return ex.Message;
            }

            return "OK";
}


Bye,
ANeuby
AnswerRe: Problem updating data in an MSSQL database Pin
aneuby29-Jul-10 22:31
aneuby29-Jul-10 22:31 
QuestionBind Binary data to Gridview Pin
SatyaKeerthi1529-Jul-10 21:15
SatyaKeerthi1529-Jul-10 21:15 
AnswerRe: Bind Binary data to Gridview Pin
Arun Jacob29-Jul-10 21:28
Arun Jacob29-Jul-10 21:28 
GeneralRe: Bind Binary data to Gridview Pin
SatyaKeerthi1529-Jul-10 21:30
SatyaKeerthi1529-Jul-10 21:30 
GeneralRe: Bind Binary data to Gridview Pin
Mycroft Holmes29-Jul-10 22:14
professionalMycroft Holmes29-Jul-10 22:14 
GeneralRe: Bind Binary data to Gridview Pin
SatyaKeerthi1529-Jul-10 23:55
SatyaKeerthi1529-Jul-10 23:55 
QuestionPublishing Update problem Pin
kbalias29-Jul-10 19:40
kbalias29-Jul-10 19:40 
AnswerRe: Publishing Update problem Pin
Richard MacCutchan29-Jul-10 22:36
mveRichard MacCutchan29-Jul-10 22:36 
QuestionHow to add multiple components (texboxes,compoboxbutton etc...) to a listview Pin
aneesh kumar k29-Jul-10 18:32
aneesh kumar k29-Jul-10 18:32 
AnswerRe: How to add multiple components (texboxes,compoboxbutton etc...) to a listview Pin
Mycroft Holmes29-Jul-10 20:55
professionalMycroft Holmes29-Jul-10 20:55 
AnswerRe: How to add multiple components (texboxes,compoboxbutton etc...) to a listview Pin
Gonzalo Cao29-Jul-10 23:53
Gonzalo Cao29-Jul-10 23:53 
QuestionToggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Matt U.29-Jul-10 16:53
Matt U.29-Jul-10 16:53 
AnswerRe: Toggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Jimmanuel30-Jul-10 3:31
Jimmanuel30-Jul-10 3:31 
GeneralRe: Toggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Matt U.30-Jul-10 8:42
Matt U.30-Jul-10 8:42 
GeneralRe: Toggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Matt U.30-Jul-10 12:03
Matt U.30-Jul-10 12:03 
GeneralRe: Toggling UI Elements (ToolStrip and MenuStrip Items and the Like) Pin
Jimmanuel31-Jul-10 6:39
Jimmanuel31-Jul-10 6:39 
QuestionNHibernate CreateSqlQuery and addEntity Pin
Matt Cavanagh29-Jul-10 16:22
Matt Cavanagh29-Jul-10 16:22 

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.