我一直在尝试构建一个代码第一个桌面应用程序 - 它在我的开发机器上工作正常,但是,我似乎在尝试部署它时遇到了很多错误。
目前我无法解决的主要问题是,在运行时,我收到以下错误:
<?php
$Shedding = $db->escapeSimple($_GET['Shedding']);
$Grooming = $db->escapeSimple($_GET['Grooming requirements']);
$Exercise = $db->escapeSimple($_GET['Exercise requirements']);
$Biddabilty = $db->escapeSimple($_GET['Biddabilty']);
$Prey = $db->escapeSimple($_GET['Prey Drive']);
$Barking = $db->escapeSimple($_GET['Barking/Vocal']);
$Drive = $db->escapeSimple($_GET['Drive']);
$filter = "";
if($Shedding !== 'all'){
$filter .= "Shedding ='".$Shedding."'";
}
if($Grooming !== 'all'){
if(isset($Shedding)&&($Shedding !== 'all')){
$filter .= " AND ";
}
$filter .= "Grooming <='".$Grooming."'";
}
if($Exercise !== 'all'){
if(isset($Grooming)&&($Grooming !== 'all')||isset($Shedding)&&($Shedding !== 'all')){
$filter .= " AND ";
}
$filter .= "Exercise <='".$Exercise."'";
}
if($Biddabilty !== 'all'){
if(isset($Exercise)&&($Exercise !== 'all')||isset($Shedding)&&($Shedding !== 'all')||isset($Grooming)&&($Grooming !== 'all')){
$filter .= " AND ";
}
$filter .= "Biddabilty LIKE '%".$Biddabilty."%'";
}
if($Prey !== 'all'){
if(isset($Biddabilty)&&($Biddabilty !== 'all')||isset($Exercise)&&($Exercise !== 'all')||isset($Shedding)&&($Shedding !== 'all')||isset($Grooming)&&($Grooming !== 'all')){
$filter .= " AND ";
}
$filter .= "Prey ='".$Prey."'";
}
if($Barking !== 'all'){
if(isset($Prey)&&($Prey !== 'all')||isset($Biddabilty)&&($Biddabilty !== 'all')||isset($Exercise)&&($Exercise !== 'all')||isset($Shedding)&&($Shedding !== 'all')||isset($Grooming)&&($Grooming !== 'all')){
$filter .= " AND ";
}
$filter .= "Barking ='".$Barking."'";
}
if($Drive !== 'all'){
if(isset($Barking)&&($Barking !== 'all')||isset($Prey)&&($Prey !== 'all')||isset($Biddabilty)&&($Biddabilty !== 'all')||isset($Exercise)&&($Exercise !== 'all')||isset($Shedding)&&($Shedding !== 'all')||isset($Grooming)&&($Grooming !== 'all')){
$filter .= " AND ";
}
$filter .= "Drive ='".$Drive."'";
}
//print_r($filter);
$rs = $a->select($view,$filter,$order,$offset,$limit);
我只是了解ASP.Net/MVC/EF上的连接字符串,但是,我在winform项目中学习/使用它们时遇到了问题。经过大量搜索后,我在MSDN上找到了以下代码,允许该应用程序在我的开发机器上运行:
Unhandled exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.
Expansion of |DataDirectory| failed while processing the connection string. Ensure that |DataDirectory| is set to a valid fully-qualified path.
我将以下代码放入:
public MyConfiguration()
{
SetExecutionStrategy("System.Data.SqlClient", () => new SqlAzureExecutionStrategy());
SetDefaultConnectionFactory(new LocalDbConnectionFactory("MSSQLLocalDB"));
}
返回此内容:
System.Windows.Forms.MessageBox.Show(db.Database.Connection.ConnectionString.ToString());
我在没有任何运气的情况下尝试使用谷歌搜索,似乎无法在Stackoverflow上找到其他类似问题的人。
然后我尝试了一些方法,包括删除重新安装实体Framework nuget包,现在相同的代码返回:
Data Source=|DataDirectory|Myapp.Context.sdf;
app.config没有变化,我只是对发生的事情感到茫然。
任何人都可以理解/解释这里发生了什么吗?