Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Ejecuta una instrucción de SQL INSERT para abrir y cerrar una conexión con Cloud SQL para PostgreSQL mediante el paquete System.Data.Common de ADO.NET.
Explora más
Para obtener documentación detallada en la que se incluye esta muestra de código, consulta lo siguiente:
insertTimestamp=DateTime.UtcNow;try{using(varconnection=newNpgsqlConnection(_connectionString.ConnectionString)){connection.OpenWithRetry();using(varinsertVoteCommand=connection.CreateCommand()){insertVoteCommand.CommandText=@"INSERT INTO votes (candidate, time_cast) VALUES (@candidate, @time_cast)";varcandidate=insertVoteCommand.CreateParameter();candidate.ParameterName="@candidate";candidate.DbType=DbType.String;candidate.Value=team;insertVoteCommand.Parameters.Add(candidate);vartimeCast=insertVoteCommand.CreateParameter();timeCast.ParameterName="@time_cast";timeCast.DbType=DbType.DateTime;timeCast.Value=insertTimestamp;insertVoteCommand.Parameters.Add(timeCast);awaitinsertVoteCommand.ExecuteNonQueryAsync();}}returnContent($"Vote successfully cast for '{team}' at time {insertTimestamp}!");}catch(Exceptionex){// If something goes wrong, handle the error in this// section. This might involve retrying or adjusting// parameters depending on the situation.returnStatusCode((int)HttpStatusCode.InternalServerError,ex);}
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],[],[],[]]