我正在使用Microsoft.ACE.OLEDB.12.0连接到Microsoft Excel文件并从中获取数据.我使用Visual Studio 2012以C#语言编写代码.这是我的代码:
public DataTable getData(string fileName, string sheetName)
{
connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='"
+ fileName
+ "';Extended Properties= 'Excel 8.0;HDR=Yes;IMEX=1'";
errorCode = ErrorDefinition.ERROR_NOERROR;
errorMessage = "";
DataTable dt = new DataTable();
try
{
string query = "SELECT * FROM [" + sheetName + "]";
OleDbConnection con = new OleDbConnection(connectionString);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, con);
dataAdapter.Fill(dt);
}
catch (Exception exp)
{
errorCode = ErrorDefinition.ERROR_OLEDBERROR;
errorMessage = exp.Message;
}
return dt;
}
Run Code Online (Sandbox Code Playgroud)
问题是dt不包含文件中指定工作表的第一行.它出什么问题了?任何帮助都是先进的.
我在liferay portlet中使用了AlloyUI.
我想<input>在javascript中使用我的id.问题是在客户端更改了元素的id.
例如:
如果我将<input>'Id' 设置为"username",则将其更改为_hospital_WAR_hospitalportlet_userNameie _hospital_WAR_hospitalportlet_附加到Id,其中Hospital是我的portlet名称.
如何获取客户端ID以便我可以在jquery中使用它?
我正在开发一个ASP.NET MVC 4应用程序,我正在尝试在Entity Framework 5中运行这个Lambda表达式.
var customer = db.GNL_Customer.Where(d => d.GNL_City.FKProvinceID == advancedProvinceID || advancedProvinceID == null)
.Where(d => d.FKCityID == advancedCityID || advancedCityID == null)
.Where(d => d.FKDepartmentStoreID == advancedDepartmentStoreID || advancedDepartmentStoreID == null)
.Where(d => d.GNL_CustomerLaptopProduct.Where(r => String.Compare(r.BrandName, brandID) == 0 || brandID == null));
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<ITKaranDomain.GNL_CustomerLaptopProduct>' to 'bool'
我知道最后一个where子句是错误的,但我不知道如何纠正它.
我很有棱角.我想写一个指令,它具有我在html中使用时添加到它的所有属性.例如:
这是我的指示
'use strict';
app.directive('province', function($compile) {
return {
restrict: 'E',
link: function (scope, element, attrs, controller) {
var markup = "<select></select>";
var elem = angular.element(element);
elem.replaceWith($compile(markup)(scope));
}
};
})
Run Code Online (Sandbox Code Playgroud)
HTML:
<province class="form-control" data-target"elemntId"></province>
Run Code Online (Sandbox Code Playgroud)
我想要<select>包含我在html中添加到指令中的类和其他属性.
我想要的输出: <select class="form-control" data-target="elementId"></select>
我用过angular.element(element).attr(attr);,但没用;
任何帮助都提前感谢.
编辑
我想要添加链接函数的attrs中存在的所有属性markup.
我是 symfony 和 twig 的新手。我想使用 构建我的 html 表单BootStrap CSS Framework。所以我的表单在树枝文件中看起来像这样:
<form action="{{ path(\'register\')}}" class="form-horizontal span10 offset7" id="frmRegistration" method="POST" {{ form_enctype(form) }} novalidate>\n<fieldset>\n {{ form_widget(form._token) }}\n <div class="control-group">\n {{ form_label(form.userName, null, {\'label_attr\': {\'class\':\'control-label\'}})}}\n <div class="controls">\n {{ form_widget(form.userName, {\'attr\': {\'data-path\': path(\'ajax_user_exists\') } }) }}\n </div>\n </div>\n <div class="control-group">\n {{ form_label(form.password.first, null, {\'label_attr\': {\'class\':\'control-label\'}})}}\n <div class="controls">\n {{ form_widget(form.password.first) }}\n </div>\n </div>\n <div class="control-group">\n {{ form_label(form.password.second, null, {\'label_attr\': {\'class\':\'control-label\'}})}}\n <div class="controls">\n {{ form_widget(form.password.second) }}\n </div>\n </div>\n\n <div class="control-group"> \n <div class="controls">\n …Run Code Online (Sandbox Code Playgroud) 我正在使用visual studio 2012来开发MVC应用程序.我已经在我的项目中添加了一个ascx页面来放置报表查看器.当我从页面中的工具箱中拖放ReportViewer组件时,它没有正确显示ReportViewer并在其上显示此错误:
Failed to create designer 'Microsoft.Reporting.WebForms.ReportViewer, Microsoft.Reporting.WebForms version 10.0.0.0, Culture=natural, PublicKeyToken=b03f5f7f11d50a3a'
我还将Microsoft.ReportViewer.WebForms程序集添加到项目References中.Visual Studio 2012中的reportviewer有什么问题吗?任何帮助都提前感谢.
我确定我犯的是一个愚蠢的错误,但它花了我几个小时,我找不到解决问题的方法.一切似乎都好但不起作用.我正在使用Foundation 5透露.但是模态窗口没有显示.这是我的代码:
HTML
<a class="openModal" href="#" data-reveal-id="imagemodal"><img src="image.jpg" /></a>
<div id="imagemodal" class="reveal-modal" data-reveal>Modal</div>
Run Code Online (Sandbox Code Playgroud)
我还在body标签中包含了以下js文件:
<script type="text/javascript" src="js/foundation/foundation.js"></script>
<script>
$(document).foundation();
</script>
<script type="text/javascript" src="js/foundation/foundation.reveal.js"></script>
Run Code Online (Sandbox Code Playgroud)
任何帮助都提前感谢.
是不是可以将@Model传递给ng-initASP.NET MVC 4视图?当我这样做时,data-ng-init=init(@Model)它在init()函数中是未定义的.
$scope.init = fuynction(model){
console.log(model); // prints undefined
}
Run Code Online (Sandbox Code Playgroud)
顺便说一下,我是AngularJs的新手.任何帮助都提前感谢.
我正在开发一个liferay portlet.我使用Service Builder.问题是我是否必须在我的实体字段中使用companyID和groupID?如果我不想拥有这些字段,我该怎么办?如果我不使用它们,我如何使用resourceLocalService.addResources()方法?