0

I have this insert query

INSERT INTO MY_DB_MY_LINKED_TABLE (FIELD1, FIELD2, FIELD3, FIELD4, TIMETOENTER) values ('Sometext', '2018', '1234567', '20/11/17', 3)

Field1 - Text,

Field2 - Text,

Field3 - Text,

Field4 - Date/Time,

TIMETOENTER - Number

Not that I am using the db scheme name as well in the query.

And my job is to make this VB.NET (with Visual Studio 2005) application work on Windows 10. As you can see I am using a linked table and it contains only "_"(underscores) without dots.

My driver is

provider=microsoft.jet.oledb.4.0;data source='C:\Documents and Settings\MyUserName\My Documents\MyApp\bin\MyApp.mdb';

I have this utility function which uses ADODB.Connection.Execute() statement

Public Sub executeSqlStatement(ByRef dbConn As ADODB.Connection, ByVal sqlStmt As String, ByVal debugMode As Boolean, ByRef statusBar As System.Windows.Forms.ToolStripStatusLabel)

    Try
        dbConn.Execute(sqlStmt, CommandType.Text)
    Catch ex As Exception
        Dim funcName As String = System.Reflection.MethodInfo.GetCurrentMethod().Name
        Utils.PrintToConsole("sql stmt: " & sqlStmt)
        Utils.PrintToStatusBar(funcName & ": " & ex.Message, debugMode, statusBar)
    End Try
End Sub

I have tried to execute the query as it is in SQL View in Access 2000 query. It works. I see the row in the table.

The problem is when I run the command above executeSqlStatement() even on Windows XP, it crashes with error:

Syntax error in INSERT INTO statement.

Not sure what the problem is?

The query works executed in Access 2000. But I am not able to send direct sql command to DB2 since it has old 32-bit driver, while newer versions of Access can process 64-bit commands. Yes we installed Access 2000 but still not sure why I get the error? Any ideas?

Yes I know it should be reworked with ADO.NET but no time for that.

Vlad
  • 2,591
  • 4
  • 43
  • 88

0 Answers0