目的: 将数据从excel导入到ms访问(.mdb)数据库.
参考: https ://www.mikesdotnetting.com/article/79/import-data-from-excel-to-access-with-asp-net
技术: C#.net Windows Forms
错误: "Microsoft Jet数据库引擎找不到输入表或查询'Persons $'.确保它存在且其名称拼写正确."
码:
private void button6_Click(object sender, EventArgs e)
{
string Access = @"c:\exportdb\DestinationDB.mdb";
string connect = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\exportdb\DestinationDB.mdb;";
using (OleDbConnection conn = new OleDbConnection(connect))
{
using (OleDbCommand cmd = new OleDbCommand())
{
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO [MS Access;Database=" + Access + "].[Persons] SELECT * FROM [Persons$]";
conn.Open();
cmd.ExecuteNonQuery();
}
}
}
Run Code Online (Sandbox Code Playgroud)
注意:我创建了一个名为"DestinationDB.mdb"的MS Access数据库,其表名为"Persons",其中包含以下字段:ContactID,FirstName,SecondName,Age
此后,我已将其导出到excel以保留标头结构.
导出此excel后,我手动添加了10条记录.
这两个文件都位于"c://exportdb/source.xls"和"c://exportdb/DestinationDB.mdb"下.
请帮我解决上述错误.
谢谢!
jQuery Full Calendar - 如何防止用户在非工作时间添加事件?此外,非工作时间的背景颜色应变灰或应用任何自定义颜色。
示例:我的营业时间为:上午 9 点至下午 1 点以及下午 3 点至晚上 7 点。[下午 1 点至 3 点应有 2 小时休息时间]
代码:
$('#calendar').fullCalendar({
theme: true,
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'agendaWeek',
eventClick: updateEvent,
selectable: true,
selectHelper: true,
select: selectDate,
editable: true,
events: "JsonResponse.ashx",
eventDrop: eventDropped,
eventResize: eventResized,
eventRender: function(event, element) {
//alert(event.title);
element.qtip({
content: {
text: qTipText(event.start, event.end, event.description),
title: '<strong>' + event.title + '</strong>'
},
position: {
my: 'bottom left',
at: 'top right'
}, …Run Code Online (Sandbox Code Playgroud) 我遇到的情况是HTML设计师说你的iFrame无法使用Bootstrap进行响应,但经过研究后,我想出了以下链接,其中说iFrame可以做出响应:link1和link2.
HTML:
<div class="container">
<div class="row">
<div class="span12">
<ul class="nav nav-tabs" id="myTabs">
<li class="active"><a href="#home" data-toggle="tab">Home</a></li>
<li><a href="#dpa" data-toggle="tab">DPA</a></li>
<li><a href="#rn" data-toggle="tab">Antwon</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="home">
<p>test</p>
</div>
<div class="tab-pane" id="dpa" data-src="http://www.drugpolicy.org/">
<iframe src=""></iframe>
</div>
<div class="tab-pane" id="rn" data-src="http://player.vimeo.com/video/37138051?badge=0">
<iframe src="" width="500" height="203" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> <p><a href="http://vimeo.com/37138051">ANTWON ? HELICOPTER</a> from <a href="http://vimeo.com/tauszik">Brandon Tauszik</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS:
$('#myTabs').bind('show', function(e) {
paneID = $(e.target).attr('href');
src = $(paneID).attr('data-src');
// …Run Code Online (Sandbox Code Playgroud) asp.net ×2
ado.net ×1
c# ×1
css ×1
fullcalendar ×1
iframe ×1
javascript ×1
jquery ×1
winforms ×1