【发布时间】:2016-03-02 08:46:08
【问题描述】:
在我的程序 (vb.net) 中,当我使用“LEN(EnterName) > 1 or LEN(EnterName) < 2”时,我只能启动一个oleDBQuery 来访问一个 Acces 2000 表,这很奇怪,因为 > 1 和
如果我不使用 LEN,则会收到此错误消息
“给定的转换无效”
这不是唯一的问题。当我使用 LEN 时,它不会返回我需要的空单元格。
如果你能帮助我会很酷。
Picture of Database and vb Application (using LEN) sry 我需要像素化除这一行之外的任何内容,这是数据保护的原因。 如果您需要更多信息,请询问我!
代码:
Using connection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\WE2015_NEU dura logo.mdb;Persist Security Info=False;")
'fills the combobox with information from the database
'═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
connection.Open() '║
Dim command_Name_Firmen As New OleDbCommand("SELECT Betrieb FROM MaterialHist Where LEN(Betrieb) > 1 or LEN(Betrieb) < 2", connection) '║
Dim reader_Name_Firmen As OleDbDataReader = command_Name_Firmen.ExecuteReader() '║
While reader_Name_Firmen.Read() '║
DatenbankboxDrölf.Items.Add(reader_Name_Firmen.GetString(0)) ''Here in the Brackets is the error if i would not use LEN '║(Datenbankdrölf = Combobox)
End While '║
reader_Name_Firmen.Close() '║
connection.Close() '║
'═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
End Using
【问题讨论】:
-
您能否给我们一些背景信息:这些“细胞”是什么?您指的是 Excel 数据吗?
-
看到一些代码也很酷......
-
Sry Guys 写的匆忙,因为工作时间结束了,然后我忘记了这个问题._.
-
你的问题真的不清楚。你想从你的查询中得到什么?
Betrieb为空的行?还是不空?哪个查询返回了您的错误消息? -
观看图片!然后你明白我的意思。有些单元格是空的,有些则不是。如果我使用 LEN 那么它只返回填充的单元格,但我需要空单元格!
标签: vb.net oledb ms-access-2000