This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DateTime fecha; | |
CultureInfo esES = new CultureInfo("es-ES"); | |
DateTime.TryParseExact(fechaRep, "yyyy-MM-dd", esES, DateTimeStyles.None, out fecha); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string res = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(str.ToLower()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Ext | |
{ | |
public static bool In<T>(this T t, params T[] values) | |
{ | |
foreach (T value in values) | |
{ | |
if (t.Equals(value)) | |
{ | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For Each c As Object In Form1.Controls | |
If c.GetType Is GetType(TextBox) Then | |
AddHandler DirectCast(c, TextBox).TextChanged, AddressOf CamposForm_TextChanged | |
End If | |
Next | |
Sub CamposForm_TextChanged(ByVal sender As TextBox, ByVal e As System.EventArgs) | |
CamposCambiados.Value = CamposCambiados.Value & IIf(CamposCambiados.Value <> "", ", " & sender.ID, sender.ID) | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TRIGGER [dbo].[NombreTrigger_UpdIns] ON [dbo].[NombreTabla] | |
FOR UPDATE, INSERT AS | |
UPDATE NombreTabla | |
SET UserName = coalesce(suser_sname(),'?'), | |
UserDateTime = GETDATE() | |
WHERE id IN (SELECT DISTINCT id FROM Inserted) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Al vaciar la tabla | |
delete NombreTabla | |
DBCC CHECKIDENT ('NombreTabla', RESEED, 0); | |
-- Al siguiente valor | |
declare @max int | |
SELECT @max=max([Id]) FROM NombreTabla | |
if @max IS NULL | |
SET @max = 0 | |
DBCC CHECKIDENT ('[NombreTabla]', RESEED, @max) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t.NAME AS NombreTabla, | |
s.Name AS Esquema, | |
p.rows AS NumFilas, | |
SUM(a.total_pages) * 8 AS EspacioTotal_KB, | |
(SUM(a.total_pages) * 8)/ 1024 AS EspacioTotal_MB, | |
((SUM(a.total_pages) * 8)/ 1024/1024) AS EspacioTotal_GB, | |
SUM(a.used_pages) * 8 AS EspacioUsado_KB, | |
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS EspacioNoUsado_KB | |
FROM sys.tables t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Ver: https://stackoverflow.com/questions/37359161/how-would-i-make-a-yes-no-prompt-in-console-using-c | |
bool confirmed = false; | |
string Key; | |
do { | |
Console.Write("Please enter a login key: "); | |
Key = Console.ReadLine(); | |
Console.WriteLine("You entered, " + Key + " as your login key!"); | |
ConsoleKey response; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[CapitalizeFirstLetter] | |
( | |
--string need to format | |
@string VARCHAR(200)--increase the variable size depending on your needs. | |
) | |
RETURNS VARCHAR(200) | |
AS | |
BEGIN | |
--Declare Variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[fnExtraerEmails] (@email varchar(255)) | |
RETURNS VARCHAR(255) | |
AS | |
BEGIN | |
declare @Izda varchar(255); | |
declare @RevIzda varchar(255); | |
declare @Dcha varchar(255); | |
declare @resultado varchar(255); |
OlderNewer