Dim connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""d:\sprrg\\scm\scm\sprrg.mdb"";")
Dim adapter As New OleDbDataAdapter("SELECT * FROM mr_head", connection)
Dim dbInsert As New OleDb.OleDbCommand
Dim table As New DataTable
adapter.Fill(table)
'job_code,mr_no,mr_date,item_code,qty,mr_status,mr_approved_date
'Dim row As DataRow = table.Rows(0)
connection.Open()
dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "job_code"
dbInsert.Parameters.Item("job_code").Value = jobcode
dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "mr_no"
dbInsert.Parameters.Item("mr_no").Value = mr_no
dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "mr_date"
dbInsert.Parameters.Item("mr_date").Value = mr_date
dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "item_code"
dbInsert.Parameters.Item("item_code").Value = itemcode
dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "qty"
dbInsert.Parameters.Item("qty").Value = qty
dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "status"
dbInsert.Parameters.Item("status").Value = status
dbInsert.Parameters.Add(dbInsert.CreateParameter).ParameterName = "mr_approved_date"
dbInsert.Parameters.Item("mr_approved_date").Value = auth_date
dbInsert.CommandText = "insert into table1 values (job_code,mr_no,mr_date,itemcode,qty,status,auth_date);"
dbInsert.CommandType = CommandType.Text
dbInsert.Connection = connection
dbInsert.ExecuteNonQuery()
MsgBox("Saved")
connection.Close()
When i execute this query i am getting the error as
Number of query values and destination fields are not the same.
Kindly help...