Posts

Showing posts from November, 2020

Convert TIME to Seconds in MSSQL

  Just put in the Time, and it will return the Seconds DECLARE @Time Varchar(10) SELECT DATEDIFF(second,0,cast(@Time as datetime))

Cannot Call Stored Procedure using Entity Framework

 How to call Stored Procedure using Entity Framework? First you have to Add the SP to Entity Framework Model. But you cannot see the SP name under Complex Types or Function Model under Model Browser. It lies with your SP that using Temp table. If you are using Temp Table in your SP, you must add SET FMTONLY OFF;    On top of the SP, and re-add the SP, the SP will be usable in Entity Framework.

JavaScript Regexp Regular Expression

  <!DOCTYPE html>   <html> <body> <p>The test() method returns true if it finds a match, otherwise it returns false.</p> <p>Click the button to search a string for the character "e".</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() {     var str = "-2:59";   var patt = /^-?\d*:[0-5][0-9]/;   var res = patt.test(str);   document.getElementById("demo").innerHTML = res; } </script> </body> </html>  .test() method will return true if format is correct and false if format is wrong. var patt = /^-?\d*:[0-5][0-9]/; ^-   Means optional of - \d* means any digit of decimal \d   Means only one digit :     Means compulsory to put : ^:   Means optional to put : [0-5]  means only can enter number 0-5 only. [0-9]  means only can enter number 0-9 only. Above formula is to force user enter  time format in positive

Mvc Razor Load Partial view using javascript

You can just load the Partial view using this code: Load the Partial view to the DIV          $( "#divdetail" ).load( ' @ Url.Action( "_Detail" , "GEMS_BCRpt" ) '  +  "?ID="  + ID );   <script>     $(function() {         $("#btn").click(function() {             var id = 10;             var valoare = 'test';             var url = '/TestingImages/Index2?Id=' + id + '&valoareselectata=' + valoare;             window.location.href = url;         });     }) </script> <input id="btn" type="button" value=“submit"/> function changedet(ID) {             $( "#divdetail" ).load( ' @ Url.Action( "_Detail" , "GEMS_BCRpt" ) ' + "?ID=" + ID );     }