У меня возникла одна и та же проблема, и проблема заключалась в том, что у меня было несколько проектов в решении (Web
и Droid
), и хотя Default project
был выбран в Package Manager Console
, он использовал строку подключения из Droid
project:
PM> update-database -Verbose
Using StartUp project 'Droid'. <-- DROID
Using NuGet project 'Web'. <-- WEB
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
<!-- BAD TARGET DATABASE -->
Target database is: 'DefaultConnection' (DataSource: .\SQLEXPRESS, Provider: System.Data.SqlClient, Origin: Convention).
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
[REMOVED TEXT]
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:-1,State:0,Class:20
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
После установки Startup Project
на Web
и Default Project
в Package Manger Console
я получил его для работы.
Используйте minDate и maxDate для отключения прошлых и будущих дат.
$(document).ready(function() {
var today = new Date();
var newdate = new Date();
newdate.setDate(today.getDate() + 15);
var maxtime = new Date();
maxtime.setMinutes(maxtime.getMinutes() + 30); // timestamp
$.datetimepicker.setLocale('pt-BR');
$('#datetimepicker').datetimepicker({
minDate: today,
minDateTime: today,
maxDate: newdate,
step: 30
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.4/jquery.datetimepicker.min.css" />
<!-- Here by using Id selector the datetime picker will load on this input element -->
<input id="datetimepicker">
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.4/build/jquery.datetimepicker.full.min.js"></script>
<script src="http://cdn.craig.is/js/rainbow-custom.min.js"></script>
<script>
$(document).ready(function() {
var today = new Date();
var newdate = new Date();
newdate.setDate(today.getDate() + 15);
var maxtime = new Date();
maxtime.setMinutes(maxtime.getMinutes() + 30); // timestamp
$('#datetimepicker').datetimepicker.setLocale('pt-BR');
$('#datetimepicker').datetimepicker({
minDate: today,
minDateTime: today,
maxDate: newdate,
step: 30
});
});
</script>