In my program (vb.net) I can only start a oleDBQuery
to access a Acces 2000 Table when there are some cells empty, when I use "LEN(EnterName) > 1 or LEN(EnterName) < 2
", which is strange, cause > 1 and <2 would just select any cell just like without LEN.
If i dont use LEN then I get this Error Message
"The given transformation is invalid"
This isn't the only problem. When I use LEN it does not return the empty Cells, which i need.
Would be cool if you could help me.
Picture of Database and vb Application (using LEN) sry I needed to pixelate anything but this one line, cause of data protection. If you need more information, please ask me!
Code:
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
It seems you need a proper handling of NULL values, using IsDbNull()