惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

博客园 - Render

数据绑定表达与javascript字符串连用 - Render - 博客园 手工删除打印任务 burrow在某些项目使用中报"控件包含代码块(即 <% ... %>),因此无法修改控件集合" - Render httpModules remove does not work in a folder or virtual directory 事件触发型ActiveX放置在网页中的部分思考 Javascript中文字符串处理额外注意事项 - Render - 博客园 Arc Catalog重建索引时报错:ORA-02298: 无法验证 (SDE.A18_FK1) - 未找到父项关键字 (A18_FK1) 指定web.config让httphandler处理某目录及子目录下所有文件 - Render - 博客园 windows命令行里取得年-月-日-时-分-秒的办法 - Render - 博客园 网站复杂信息自动录入处理 css中url的路径含义 ORACLE Transparent Gateway透明网关安装配置小问题 ARCIMS Serverlet Connector查询属性,当属性为中文时乱码处理 - Render [转载]ARCIMS 9.2 [ERR0134]错误解决方法 ORACLE 大数据表Update处理 PL/SQL developer的HomeEnd问题(转载) ArcSDE9.0对Oracle初始化参数的要求 在SDE中创建dataset时"Fail to Create, Cann't found spatial referrence entry"错 处理Oralce中非法的日期值
使用OLEDB访问ACCESS的几点经验
Render · 2008-10-10 · via 博客园 - Render

1.取得序列号(顺序号)
如果习惯了ORACLE的Sequence,到ACCESS下使用自动编号字段还是会不习惯:如何取得新的编号值,如何拿他来做关联字段值?
可以做如下一个函数:

''' <summary>
    
''' 取得序列的下一值,用于处理自动编号字段,库表结构为SeqTable(IDField,AA),AA为数字型字段
    
''' </summary>
    
''' <param name="strSeqTable"></param>
    
''' <returns></returns>
    
''' <remarks></remarks>

    Public Shared Function GetSeqValue(ByVal theOleDbAccess As OleDbAccess, ByVal strSeqTable As StringAs Object
        
Try
            
Dim aCon As OleDbConnection = CType(theOleDbAccess.OpenConnection(CType(aCon, IDbConnection)), OleDbConnection)
            
Dim strSQL1 As String = "insert into " & strSeqTable & "(AA)values(1)"
            
Dim strSQL2 As String = "SELECT @@IDENTITY"
            
Dim aCmd As New OleDbCommand(strSQL1, aCon)
            aCmd.ExecuteNonQuery()
            aCmd.Dispose()
            
Dim aCmd2 As New OleDbCommand(strSQL2, aCon)
            
Return aCmd2.ExecuteScalar()
        
Catch ex As Exception
            modOutputLog.OutputLog(ex)
            
Throw ex
        
End Try
    
End Function

2.字段名的保留字
开始从ORACLE转到ACCESS,因为要做一单机版程序,并要导数据到ORACLE上,因此采用了和ORACLE库表一样的结构,如下:
UID,PhoneNo,Address,Password
一切SELECT都正常,我手工往里加了数据,访问也正常,直到我想从ORACLE导数据并insert到ACCESS时,出错了:无效的INSERT语句!
我更新用的是oleDBDataAdapter生成的SQL来更新的,到我改成手工的:
insert into AAAA(UID,PhoneNo,Address,Password) values(xxxxxxx)也还是不行。
我用上面的SQL在ACCESS中构造了一个查询,又是可以执行的,怪了。
后来一个字段一个字段去掉,才发现,原来PASSWORD是OLEDB的一个保留字,拿来做字段名,写在SQL中要转义,写成
insert into AAAA(UID,PhoneNo,Address,[Password]) values(xxxxxxx),就正常了。

这几个问题忙得实在不太值,都是一些约定上的东西,要自己一点一点分析出来,效率太低了。