24 lines
916 B
C#
24 lines
916 B
C#
using System.Data.Sql;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace ConsoleApplication1
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
using var tConn = new SqlConnection("ConnectionString");
|
|
|
|
using var tCommand = tConn.CreateCommand();
|
|
tCommand.CommandText = "UPDATE players SET name = @name, score = @score, active = @active WHERE jerseyNum = @jerseyNum";
|
|
|
|
tCommand.Parameters.Add(new SqlParameter("@name", System.Data.SqlDbType.VarChar).Value = "Smith, Steve");
|
|
tCommand.Parameters.Add(new SqlParameter("@score", System.Data.SqlDbType.Int).Value = "42");
|
|
tCommand.Parameters.Add(new SqlParameter("@active", System.Data.SqlDbType.Bit).Value = true);
|
|
tCommand.Parameters.Add(new SqlParameter("@jerseyNum", System.Data.SqlDbType.Int).Value = "99");
|
|
|
|
tCommand.ExecuteNonQuery();
|
|
}
|
|
}
|
|
}
|