首页 \ 问答 \ 使用ADODB将csv文件作为记录集打开时的空备忘录字段(Null memo fields when opening a csv file as a recordset using ADODB)

使用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
更新时间:2023-08-11 08:08

最满意答案

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 ...
  • 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 ...
  • 我建议使用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); } ...
  • 您可以添加和删除className而不是设置元素的style ,使用setTimeout在4秒后使用loopKeyFrame作为参数调用requestAnimationFrame 。 function runKeyFrame() { document.getElementById("box").className = "myMove"; } function loopKeyFrame() { runKeyFrame(); setTimeout(function() { d ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。