使用ADODB将csv文件作为记录集打开时的空备忘录字段(Null memo fields when opening a csv file as a recordset using ADODB)
我非常坚持这一点,不知道如何继续。 我正在使用ADODB打开CSV文件,这是正常工作但是我的CSV文件中存在的文本字段被打开为空字段,所有数字字段都正确设置。
我这样打开CSV文件;
Set adoOpen = Server.CreateObject("ADODB.Connection") adoOpen.ConnectionString = "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=C:/;Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Info=False" adoOpen.Open Set rsOpenRS = Server.CreateObject("ADODB.Recordset") sSQL = "SELECT * FROM `Import.csv`" rsOpenRS.Open sSQL, adoCon
我还有一个schema.ini文件设置,它告诉我如何打开我的字段,就像这样
[Import.csv] ColNameHeader=True Format=CSVDelimited Col1=MyTextField Memo Col2=MyNumberField Double Col3=MyOtherNumberField Double
我的CSV文件中的数据如下所示
MyTextField,MyNumberField,MyOtherNumberField "Some text here",1,100
当我遍历我的字段时,我希望看到以下内容
MyTextField = Some text here MyNumberField = 1 MyNumberField = 100
但相反,我得到的是这个
MyTextField = MyNumberField = 1 MyNumberField = 100
它只是忽略该字段中的文本,但文本肯定存在于CVS文件中。
我尝试使用Text而不是Memo,这可行,但它只带回前255个字符,而且我的一些字段有更多,所以它们被截断了。
我希望有人可以帮助我。
干杯
I'm pretty stuck with this and don't know how to proceed. I am using ADODB to open a CSV file, this is working correctly however my text fields that exist in the CSV file are being opened as null fields, all of the number fields are correctly being set.
I open the CSV file like so;
Set adoOpen = Server.CreateObject("ADODB.Connection") adoOpen.ConnectionString = "Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=C:/;Extensions=asc,csv,tab,txt;HDR=NO;Persist Security Info=False" adoOpen.Open Set rsOpenRS = Server.CreateObject("ADODB.Recordset") sSQL = "SELECT * FROM `Import.csv`" rsOpenRS.Open sSQL, adoCon
I also have a schema.ini file set up which tells it how I want my fields to be opened, like so
[Import.csv] ColNameHeader=True Format=CSVDelimited Col1=MyTextField Memo Col2=MyNumberField Double Col3=MyOtherNumberField Double
My data in my CSV file looks like this
MyTextField,MyNumberField,MyOtherNumberField "Some text here",1,100
When I loop through my fields I would expect to see the following
MyTextField = Some text here MyNumberField = 1 MyNumberField = 100
But instead what I get is this
MyTextField = MyNumberField = 1 MyNumberField = 100
It just ignores the text that is in that field, but the text is definitely there in the CVS file to start with.
I have tried using Text instead of Memo, this works, however it only brings back the first 255 characters, and some of my fields have more than this so they are getting truncated.
I hope somebody can help me out.
Cheers
原文:https://stackoverflow.com/questions/29624757
最满意答案
将
requestAnimationFrame
用于当前代码或要更改的代码是没有意义的。对于当前的代码,你正在设置一个样式,然后让CSS接管。 一段时间过后,没有必要做任何事情。
要将其更改为重置并重复循环,您需要在动画完成时触发新代码,而不是在浏览器准备好渲染新帧时触发。 为此,请监听
transitionend
事件,然后移除变换值以将其设置回默认值。var testdiv = document.querySelector("div"); testdiv.addEventListener("transitionend", animate); setTimeout(animate, 100); function animate() { if (testdiv.style.transform) { testdiv.style.transform = ""; } else { testdiv.style.transform = "rotate(45deg)"; } }
body { padding: 100px; } div { transition-Duration: 2500ms; transition-Timing-Function: linear; }
<div>....</div>
It doesn't make sense to use
requestAnimationFrame
for either your current code, or the code you want to change to.For the current code, you're setting a style and then letting CSS take over. There's no need to do anything after time has passed.
To change it to reset and repeat the loop, you want to trigger the new code when the animation has finished, not when the browser is ready to render a new frame. To do that, listen for the
transitionend
event and then remove the transform value to set it back to the default.var testdiv = document.querySelector("div"); testdiv.addEventListener("transitionend", animate); setTimeout(animate, 100); function animate() { if (testdiv.style.transform) { testdiv.style.transform = ""; } else { testdiv.style.transform = "rotate(45deg)"; } }
body { padding: 100px; } div { transition-Duration: 2500ms; transition-Timing-Function: linear; }
<div>....</div>
相关问答
更多-
这里的错误行为是由于来自requestAnimationFrame timeoutID和返回值都被保存到同一个变量中而引起的。 将它们保存在不同的变量中将解决问题。 这是一个codepen http://codepen.io/anon/pen/KzPboY?editors=0010 The buggy behavior here is being caused because both timeoutID and return value from requestAnimationFrame are bei ...
-
我见过大多数编码器把requestAnimationFrame放在循环的底部...... 但我不确定这是否必要。 假设你开始第一个循环。 然后,在第一个循环中,您立即请求第二个循环。 在尝试第二个循环之前,第一个循环将始终完全执行。 那是因为requestAnimationFrame为你排队多个不完整的帧循环,所以如果当前循环运行很长,它只会延迟下一个循环,直到当前循环结束。 使用rAF时,您不会丢弃帧循环。 演示如何requestAnimationFrame队列循环 这个演示运行10个循环, reques ...
-
启动/停止的一种方式就是这样 var requestId; function loop(time) { ... // do stuff ... start(); } function start() { if (!requestId) { requestId = window.requestAnimationFrame(loop); } } function stop() { if (requestId) { wind ...
-
为Canvas动画减少/ thottle requestAnimationFrame(reduce / thottle requestAnimationFrame for Canvas animation)[2021-09-19]
const fps = 5; const delay = Math.ceil(1000 / fps); let last = Date.now(); let now; function step () { now = Date.now(); if(now - last < delay) { return requestAnimationFrame(step); } last = now; update(); draw(); reque ... -
将requestAnimationFrame用于当前代码或要更改的代码是没有意义的。 对于当前的代码,你正在设置一个样式,然后让CSS接管。 一段时间过后,没有必要做任何事情。 要将其更改为重置并重复循环,您需要在动画完成时触发新代码,而不是在浏览器准备好渲染新帧时触发。 为此,请监听transitionend事件,然后移除变换值以将其设置回默认值。 var testdiv = document.querySelector("div"); testdiv.addEventListener("transit ...
-
如何在requestAnimationframe循环中的2个点之间进行插值(How to interpolate between 2 points in a requestAnimationframe loop)[2022-03-16]
我建议使用Penner方程式进行通用缓和。 这些函数可以在github上找到库: tween-functions 。 一个简单的演示,展示如何在每个帧上计算值: const Easings = [ function easeInQuad(t, b, c, d) { return c * (t /= d) * t + b; }, function easeOutBounce(t, b, c, d) { if ((t /= d) < (1 / 2.75)) { ... -
requestAnimationFrame实际上并没有为你渲染任何东西,它只是将浏览器的渲染循环同步到你的代码中,所以你可以使用它来以编程方式在屏幕上渲染动画。 它所做的就是触发每次浏览器呈现框架时提供的回调函数。 以下是一个很好的例子:制作一个JavaScript游戏 requestAnimationFrame doesn't actually render anything for you, it simply syncs the browser's rendering loop to your cod ...
-
在单个requestAnimationFrame更新所有画布是完全可以的。 如果画布彼此独立并出现在页面的不同部分,那么您可能希望使用单独的requestAnimationFrame处理程序,将canvas元素作为第二个参数传递。 这样,只有当前可见的画布才会更新。 (然而,传递元素作为第二个参数是WebKit特有的)。 requestAnimationFrame作用是告诉浏览器您要更新页面的外观。 浏览器在页面或元素下次重新绘制时调用回调。 当页面/元素可见时,这种情况就会发生,并且永远不会超过屏幕刷新率 ...
-
好的,所以我接近这个错误的方式,这篇文章帮助我理解了一个更好的方法来处理它: http : //creativejs.com/resources/requestanimationframe/ 具体来说: var fps = 15; function draw() { setTimeout(function() { requestAnimationFrame(draw); // Drawing code goes here }, 1000 / fps); } ...
-
如何在Javascript中调用requestAnimationFrame循环?(How to call in Javascript a requestAnimationFrame loop?)[2022-04-05]
您可以添加和删除className而不是设置元素的style ,使用setTimeout在4秒后使用loopKeyFrame作为参数调用requestAnimationFrame 。 function runKeyFrame() { document.getElementById("box").className = "myMove"; } function loopKeyFrame() { runKeyFrame(); setTimeout(function() { d ...