Watch this example on YouTube
Replace
ALTER PROCEDURE spTestExit
AS
BEGIN
SET NOCOUNT ON;
Select * from TestTable
END
GO
exec spTestExit 'sss'
exec spTestExit null
With
ALTER PROCEDURE spTestExit
@Name varchar(50)
AS
BEGIN
SET NOCOUNT ON;
if @Name Is null
Begin
Return
End
Select * from TestTable
END
GO
exec spTestExit 'sss'
exec spTestExit null
Tuesday, 23 July 2019
Saturday, 20 July 2019
MSSQL - Fix Error - - Unable to modify table. Cannot insert the value NULL into column 'Address', table 'Company.dbo.Tmp_TestTable'; column does not allow nulls. INSERT fails. The statement has been terminated.
Watch this example on YouTube
'TestTable' table
- Unable to modify table.
Cannot insert the value NULL into column 'IsActive', table 'Company.dbo.Tmp_TestTable'; column does not allow nulls. INSERT fails.
The statement has been terminated.
to fix it do it manually
Update TestTable Set IsActive = 1 where IsActive is null
Alter Table TestTable
Alter Column IsActive bit Not Null
MSSQL - Fix Error - There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
Watch this example on YouTube
There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
To fix it replace
Insert Into TestTable (ID, Name) Values (1, 'aaa', 'bbb')
with
Insert Into TestTable (ID, Name) Values (1, 'aaa')
C# - Convert DateTime to Month Year - like December 2019
Watch this example on YouTube
string ConvertedDT = DateTime.Now.ToString("MMMM") + " " + DateTime.Now.Year.ToString();
string ConvertedDT = DateTime.Now.ToString("MMMM") + " " + DateTime.Now.Year.ToString();
C# - Fix Error - Literal of type double cannot be implicitly converted to type 'decimal'; use an 'M' suffix to create a literal of this type
Watch this example on YouTube
To Fix it replace
Decimal Rate = 1.0000;
with
Decimal Rate = 1.0000M;
To Fix it replace
Decimal Rate = 1.0000;
with
Decimal Rate = 1.0000M;
C# - Fix Error - Index and length must refer to a location within the string. - Check against string length
Watch this example on YouTube
Fix error
An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code
Additional information: Index and length must refer to a location within the string.
To fix it replace
string s1 = "ab";
string s2 = s1.Substring(0, 100);
with
string s1 = "ab";
string s2 = s1.Substring(0, s1.Length> 100 ? 100: s1.Length);
Fix error
An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code
Additional information: Index and length must refer to a location within the string.
To fix it replace
string s1 = "ab";
string s2 = s1.Substring(0, 100);
with
string s1 = "ab";
string s2 = s1.Substring(0, s1.Length> 100 ? 100: s1.Length);
Subscribe to:
Posts (Atom)