DataAdapter "No value given for one or more required parameters."
Posted on 2010-01-08
I have a program that loads some data from a text file using the following code:
oledbOrderFile.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data Source=\\<dir>\<subdir>;Mode=ReadWrite;Extended Properties="text;HDR=No;FMT=Delimited(|)"
Dim sql As String = "SELECT F1 as POType, F2 as PONum, ..., F54 as ProductLine, , F55 as AddDesc, F56 as UnitSize FROM [Temp#txt]"
Dim cmd As New OleDb.OleDbCommand(sql, oledbOrderFile)
Dim da As New OleDb.OleDbDataAdapter(cmd)
Now I need to add 2 fields to the sql, which doesn't seem like that big of a deal, but for some reason I get the following error on the da.Fill(dsBasicData, "Custom"):
"No value given for one or more required parameters."
I have all the fields defined in the columns of the datatable, and the tablemapping in the dataadapter. I am not sure what I would be missing.
I also tried just loading it as:
Dim sql As String = "select * from [Temp#txt]"
which added the fields at the end of the defined fields, but still not the last 2 fields.
Any ideas what the problem may be?