Update 1st record that is from an empty set

This is how I created the table:
 
string createString = "CREATE TABLE tAZUID (MWSMerchantID VARCHAR (25), MWSMarketplaceID VARCHAR (25), " +
                "AWSAccessKey VARCHAR (25), AWSSecretKey VARCHAR (50), AWSAssocTag VARCHAR (15))";
            sqlCmd = new FbCommand(createString, maintenanceConn);
            try {
                sqlCmd.ExecuteNonQuery();
            }

Open in new window


This is how I want to update the first row:
 
string updateString = "UPDATE tAZUID SET MWSMerchantID = '" + tbMerchantID.Text + "', " +
            " MWSMarketplaceID = '" + tbMarketplaceID.Text + "', " +
            " AWSAccessKey = '" + tbAWSKey.Text + "', " +
            " AWSSecretKey = '" + tbAWSSecretKey.Text + "', " +
            " AWSAssocTag = '" + tbAZAssocTag.Text + "' ROWS 1";
            sqlCmd = new FbCommand(updateString, databaseConn);
            try {
                sqlCmd.ExecuteNonQuery();
            }

Open in new window


It's not working (nothing gets updated in the table).  What am I doing wrong?
rmmarshAsked:
Who is Participating?
 
Nick UpsonPrincipal Operations EngineerCommented:
unless you do a commit after the update it won't be visible to another connection (and the 2nd connection needs to commit as well in order to see it)

run the above, commit above, commit watching connection and it should be visible
0
 
rmmarshAuthor Commented:
Hi Nick... COMMIT didn't work... I had to initialize the table's first row with blank values, then I could do the update.  BTW, I am using the Firebird .NET wrapper.

Thanks anyway, I appreciate your help as always!  Happy New Year to you and your family!
0
 
Nick UpsonPrincipal Operations EngineerCommented:
I just assumed you were doing an insert first, you cannot update what doesn't exist
0
 
rmmarshAuthor Commented:
Hi Nick... yea, I finally figured that out! :D (I apologize for the grade... sorry)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.