Some content on this site is available only to logged-in subscribers. Contact Us for information on becoming a subscriber.

InSource.Solutions | InSource Training | InSource Client Portal
InSource Solutions Logo
Log In Sign Up
InSource.Solutions InSource Training InSource Client Portal Log In Sign Up
  • Home
  • AVEVA Application Server
  • AVEVA Application Server Tech Notes

TN AppSvr 112 Updating a SQL database record using the SQL Client

Last updated: March 6th, 2025

Description

  • Author: Joe Hefner
  • Published: March 6th, 2025

Details:

Description

Shows how to use a SQLClient connection to update and existing record in a SQL Database.

  • Author: Joseph Hefner
  • Published: 01/06/2015
  • Applies to: Application Server 3.1 or later

The screenshot below is an example of how to update a database record using a SQLClient connection. The script below will be triggered by the UpdateDB UDA belonging to this object being set to true. When this occurs, it will update the table named "Record" inside a database called XXXDB. This table contains columns called Name and Number. The example code below will search for the record with the number "1" and update its Name to "User1".

The body of the script above can be copied from below:

Me.UpdateDB = false;

dim myConnection as System.Data.SqlClient.SqlConnection;
dim command as System.Data.SqlClient.SqlCommand;

dim Connection_String as string;

command = new System.Data.SqlClient.SqlCommand;

Connection_String = "Server = JH_Sp2k14;Database = XXXDB;User ID = wwAdmin;Password = wwAdmin";
myConnection = new System.Data.SqlClient.SqlConnection(Connection_String);

command.CommandType = System.Data.CommandType.Text;
command.CommandText = "Update Record SET [Name] = @Name where [Number] = @Number";
command.Parameters.AddWithValue("@Name","User1");
command.Parameters.AddWithValue("@Number","1");
command.Connection = myConnection;

myConnection.Open();
command.ExecuteNonQuery();
myConnection.Close();
myConnection.Open();

 

update record sql client
Give feedback about this article

Recommended articles

TN 1394 Error when Deploying: Remote Node's UserID/Password don't match GR Node's

Read More

TN 1366 Managing your Standalone InTouch Application in the Galaxy

Read More

Resolving "Open: Memory on the computer is low. New editor can't be launched."

Read More

TN 1040 No Alarms in Window Viewer

Read More
Support Icon

CONTACT SUPPORT

How to reach us

10800 Midlothian Turnpike Tpke, Suite 209, Richmond, VA 23235

1.877.INSOURCE

Technical Support - 1.888.691.3858

Contact Us

  • InSource Solutions
  • InSource Training
  • InSource Client Portal
  • Log In
InSource Solutions Logo

© 2025 InSource Solutions. All Rights Reserved.

Knowledge Base Software powered by Helpjuice

Expand