Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updated or not?

Status
Not open for further replies.

Davidmc555

Programmer
Feb 7, 2005
39
GB
I have a simple ASP.net app that accesses an Access DB. Now, this query could go anywhere but I'm gonna try here.

Using an OleDB Connection and Command object, I'm called an update command using JET sql. No problems there, it does what it should.

The thing is I'd like to know if it actually updates or not to provide the user with a prompt if it doesn't.

Code:
conActiveObj = New OleDb.OleDbConnection

            conActiveObj.ConnectionString = ConfigurationSettings.AppSettings("OleDBConnection").Replace("fullpath", Server.MapPath("/"))
            conActiveObj.Open()

            strSQLQry = "UPDATE License As L SET L.licenseActivation = Now() WHERE(L.licenseClientID = " & txtClientID.Text & ") AND L.licenseCode = '" & txtLicenseKey.Text & "' AND L.licenseDateTime = (Select MAX(licenseDateTime) From License Where License.licenseClientID = L.licenseClientID AND License.licenseCode = L.LicenseCode);"

            cmdActive = New OleDb.OleDbCommand(strSQLQry, conActiveObj)
            cmdActive.ExecuteNonQuery()

Any ideas would be a great help.
 
Not as difficult as I had thought actually.

ExecuteNonQuery() returns a number reflecting the number of affected rows. 0 therefore meaning that the statement had no effect on the table.

Hope this helps someone in the future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top