我收到以下错误:
"Incorrect Syntax near '.'. Expected ID or Quoted_ID".
在尝试创建以下过程时,
CREATE PROCEDURE [dbo].[SP_NAME]
@DBName varchar(max)
As
Begin
SELECT NBCGL_TRANSACTION.*, MRG_BSLA.GL_BSLA_CODE AS BSLA
FROM @DBName..NBCGL_TRANSACTION LEFT OUTER JOIN MRG_BSLA
ON NBCGL_TRANSACTION.BUSINESS = MRG_BSLA.BSLA_CODE
WHERE NBCGL_TRANSACTION.TRANSACTION_TYPE = 2
END
Run Code Online (Sandbox Code Playgroud) 我试图通过Java连接到SQL Server 2008.
sqljdbc4.jar到我的项目库中了.SQL异常:com.microsoft.sqlserver.jdbc.SQLServerException:用户''登录失败.ClientConnectionId:085d5df3-ad69-49e1-ba32-b2b990c16a69
相关代码:
public class DataBases
{
private Connection link;
private java.sql.Statement stmt;
public ResultSet rs;
public DataBases()
{
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=DB;";
Connection con = DriverManager.getConnection(connectionUrl);
}
catch (SQLException e)
{
System.out.println("SQL Exception: "+ e.toString());
}
catch (ClassNotFoundException cE)
{
System.out.println("Class Not Found Exception: "+ cE.toString());
}
}
}
Run Code Online (Sandbox Code Playgroud) 我尝试在我的swift应用程序中使用自定义字体,但它们不加载.
我复制了我的资源文件夹中的fonts.ttf,并在Info.plist中的"应用程序提供的字体"键下添加了名称.
我尝试使用.plist中的"应用程序字体资源路径"键,但没有结果.这是我用来应用我的字体的代码.我试过:"MyFont.ttf"和"MyFont"
@IBOutlet weak var label:NSTextField!
override func awakeFromNib() {
label.font = NSFont(name: "MyFont.ttf", size: 15)
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试Score_Waarde使用以下代码从我的数据库中获取值:
critid = critid_arr[teller2].ToString();
int scorehulp = 0;
string userid = Session["userid"].ToString();
SqlCommand cmd3 = new SqlCommand("SELECT Score_Waarde FROM Score WHERE Crit_ID = '" + critid + "' AND User_ID = '" + userid + "' ", con);
scorehulp = (int)cmd3.ExecuteScalar();
Run Code Online (Sandbox Code Playgroud)
当我尝试运行它时,我收到以下错误:指定的强制转换无效.我不明白为什么我得到这个错误,因为critid并userid给出了正确的值.
我正在尝试创建一个简单的Windows服务.该服务的用户帐户是NetworkService.然后我installUtil从命令提示符运行,我得到了这个:
提交阶段成功完成.
事务处理安装已完成.
这意味着服务已成功安装.但是,当我尝试从Service applet我运行它得到此错误:
Windows cannot the CustomersService service on Local Computer. Error 5 : Access is denied.
我使用64位Windows 7.
我正在尝试使用PHPUnit运行selenium测试用例.我做的第一件事是尝试登录功能,这是完美的,但我想运行一个函数来检查登录后页面上的信息,但它打开一个新的浏览器,而不是继续在当前的浏览器窗口.这是一个问题的原因是因为页面设置为在窗口关闭时删除登录身份验证,所以如果你使用$ this-> url()转到页面,它会给出我需要登录的错误.这是我的代码,它启动浏览器并运行测试登录表单的功能,然后关闭浏览器,打开一个新的并运行链接检查.这当然会因为身份验证错误而导致错误,因为窗口已关闭.我可以在一个函数中运行所有测试,但这实际上是草率编码,我想避免这种情况.有谁知道如何解决这个问题?
<?php
class TestMyTest extends PHPUnit_Extensions_Selenium2TestCase {
public function setUp()
{
$this->setBrowser("firefox");
$this->setBrowserUrl("https://**************************");
}
public function testLoginForm()
{
$this->url("login.php");
$this->byLinkText('Forgot your password?');
$form = $this->byCssSelector('form');
$this->byName('username')->value('test');
$this->byName('password')->value('1234');
$form->submit();
}
public function testCheckForMainMenueLinks ()
{
$this->url("index.php");
$this->byLinkText('Home');
$this->byLinkText('Products');
$this->byLinkText('About us');
$this->byLinkText('Contact');
}
}
?>
Run Code Online (Sandbox Code Playgroud) 我有一个WCF服务,它将客户保存到数据库,并在Internet Explorer中按预期工作,但不在 Chrome中工作(因此我会遗漏HTML/Json,因为它让我觉得这是一个Web配置问题,但我可以发布如果有人喜欢).
在Chrome中我收到错误:
无法加载资源:服务器响应状态为405(方法不允许)Subscriber.htm:1 XMLHttpRequest无法加载http://example.com/MyService.svc/SaveCustomer.无效的HTTP状态代码405
我的网站配置:
<system.web>
<compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
<pages>
<namespaces>
<add namespace="System.Runtime.Serialization" />
<add namespace="System.ServiceModel" />
<add namespace="System.ServiceModel.Web" />
</namespaces>
</pages>
</system.web>
<system.serviceModel>
<services>
<service name="IService.MyService">
<endpoint address="http://example.com/MyService.svc"
binding="webHttpBinding"
bindingConfiguration=""
contract="IService"
behaviorConfiguration="webHttpBinding" />
</service>
</services>
<client>
<endpoint
binding="webHttpBinding"
bindingConfiguration=""
address="http://example.com/MyService.svc"
contract="IService" />
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/> …Run Code Online (Sandbox Code Playgroud) 我使用ASP .NET Core RC1与Facebook身份验证和silding窗口cookie过期设置如下:
app.UseIdentity();
app.UseFacebookAuthentication();
Run Code Online (Sandbox Code Playgroud)
和
services.AddIdentity<ApplicationUser, IdentityRole>((options =>
{
options.Cookies.ApplicationCookie.CookieName = "myauthcookie";
options.Cookies.ApplicationCookie.ExpireTimeSpan = TimeSpan.FromDays(5);
options.Cookies.ApplicationCookie.SlidingExpiration = true;
}))
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
Run Code Online (Sandbox Code Playgroud)
这在用户首次登录时工作正常 - cookie过期设置正确.但是,当用户返回页面时,cookie的到期时间设置为"会话",因此实际上用户必须重新验证每次其他访问.
为什么会这样?我没有正确配置吗?
更新:我现在已经完成了一些没有SlidingExpiration的测试,问题仍然存在.返回页面后,cookie的到期时间将更改为"会话".我正在使用Chrome.
另外,我没有在https上运行.这可能是一个因素吗?
package xml.dierenshop.flaming.v1;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.output.XMLOutputter;
import org.jdom2.output.Format;
import java.io.FileWriter;
import java.io.IOException;
public class Writer {
public void Writer(String categorie, String code, String naamartikel, String beschrijvingartikel, double prijz, String imgurl, String imgurl2, String imgurl3, String imgurl4, String imgurl5) {
String prijs = String.valueOf(prijz);
Document document = new Document();
Element root = new Element("productlist");
String naamelement = "naam";
String categorieelement = "category";
String descriptionelement = "description";
Element child = new Element("product");
child.addContent(new Element(categorieelement).setText(categorie));
child.addContent(new Element("code").setText(code));
child.addContent(new Element(naamelement).setText(naamartikel));
child.addContent(new Element(descriptionelement).setText(beschrijvingartikel)); …Run Code Online (Sandbox Code Playgroud) 我将数据更新到数据库时遇到问题.当我想更新数据时,Entitiy Framework会向可以有多行的表(具有外键的表)添加新行.
数据库模型:

当我更新电话/联系人或标签实体时,实体框架会自动添加新行而不是更新它
这是我使用的代码:
public string UpdateContact(Contact contact)
{
if (contact != null)
{
int id = Convert.ToInt32(contact.id);
Contact Updatecontact = db.Contacts.Where(a => a.id == id).FirstOrDefault();
Updatecontact.firstname = contact.firstname;
Updatecontact.lastname = contact.lastname;
Updatecontact.address = contact.address;
Updatecontact.bookmarked = contact.bookmarked;
Updatecontact.city = contact.city;
Updatecontact.notes = contact.notes;
Updatecontact.Emails1 = contact.Emails1;
Updatecontact.Phones1 = contact.Phones1;
Updatecontact.Tags1 = contact.Tags1;
db.SaveChanges();
return "Contact Updated";
}
else
{
return "Invalid Record";
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:
这是EF模型代码:
联系:
public partial class Contact
{
public Contact()
{
this.Emails1 = new …Run Code Online (Sandbox Code Playgroud) asp.net ×3
.net ×2
c# ×2
java ×2
sql ×2
asp.net-core ×1
class ×1
custom-font ×1
document ×1
jdom ×1
macos ×1
php ×1
phpunit ×1
selenium ×1
sqlexception ×1
swift ×1
t-sql ×1
unit-testing ×1
wcf ×1
wcf-binding ×1
xcode ×1
xml ×1