Migrating From SQL Server 2014 Database To MS Access 2010 Database

  • Thread starter Thread starter Developer Dude
  • Start date Start date
D

Developer Dude

Guest
Hello:

I am converting a small windows application, written in VB2013 from a SQL Server DB to an MS Access 2010 DB. I can view the data in the Access Database but my OleDb Insert Command gives me an error "Error# 5 - Characters found after the end of SQL Statement. I can't see the error. Below is the Insert Command code. Your help would be greatly appreciated.


Private Sub Insert_Command_CM()

'Create A OleDbCommand To Insert Resistor Data.
CM_InsertCommand.Connection = cnEIS
CM_InsertCommand.CommandType = CommandType.Text

strCM_InsertCommand = "INSERT INTO [dbo].[CM] ([CM_KEY], [CM_ID_D_0], [CM_ID_D_1], " & _
"[CM_ID_A_1], [CM_ID_A_2], [CM_ID_D_3], [CM_ID], " & _
"[CM_CC_1], [CM_CC_2], [CM_CC_3], [CM_PART_ID], " & _
"[CM_PART_STATUS], [CM_PART_LOC_1_QTY], " & _
"[CM_PART_LOC_2_QTY], [CM_PART_LOC_3_QTY], [CM_E_DATE], " & _
"[CM_R_DATE]) " & _
"VALUES (@CM_KEY, @CM_ID_D_0, @CM_ID_D_1, @CM_ID_A_1, " & _
"@CM_ID_A_2, @CM_ID_D_3, @CM_ID, @CM_CC_1, @CM_CC_2," & _
"@CM_CC_3, @CM_PART_ID, @CM_PART_STATUS, " & _
"@CM_PART_LOC_1_QTY, @CM_PART_LOC_2_QTY, " & _
"@CM_PART_LOC_3_QTY, @CM_E_DATE, @CM_R_DATE); " & _
"SELECT * FROM CM " & _
"WHERE (CM_KEY = @CM_KEY)"

CM_InsertCommand.CommandText = strCM_InsertCommand

CM_InsertCommand.Parameters.Add("@CM_KEY", OleDbType.Char, 14, "CM_KEY")
CM_InsertCommand.Parameters.Add("@CM_ID_D_0", OleDbType.Decimal, 38, "CM_ID_D_0")
CM_InsertCommand.Parameters.Add("@CM_ID_D_1", OleDbType.Decimal, 9)
CM_InsertCommand.Parameters.Add("@CM_ID_A_1", OleDbType.Char, 40)
CM_InsertCommand.Parameters.Add("@CM_ID_A_2", OleDbType.Char, 40)
CM_InsertCommand.Parameters.Add("@CM_ID_D_3", OleDbType.Decimal, 38)
CM_InsertCommand.Parameters.Add("@CM_ID", OleDbType.Char, 50, "CM_ID")
CM_InsertCommand.Parameters.Add("@CM_CC_1", OleDbType.Char, 20)
CM_InsertCommand.Parameters.Add("@CM_CC_2", OleDbType.Char, 40)
CM_InsertCommand.Parameters.Add("@CM_CC_3", OleDbType.Char, 40)
CM_InsertCommand.Parameters.Add("@CM_PART_ID", OleDbType.Char, 8, "CM_PART_ID")
CM_InsertCommand.Parameters.Add("@CM_PART_STATUS", OleDbType.Char, 1)
CM_InsertCommand.Parameters.Add("@CM_PART_LOC_1_QTY", OleDbType.Integer, 5)
CM_InsertCommand.Parameters.Add("@CM_PART_LOC_2_QTY", OleDbType.Integer, 5)
CM_InsertCommand.Parameters.Add("@CM_PART_LOC_3_QTY", OleDbType.Integer, 5)
CM_InsertCommand.Parameters.Add("@CM_E_DATE", OleDbType.Char, 11)
CM_InsertCommand.Parameters.Add("@CM_R_DATE", OleDbType.Char, 11, "CM_R_DATE")

End Sub

Continue reading...
 
Back
Top