J
John
Hi
I am using this (below) code for update. The problem is that when I use
update I get the error 'Parameter ?_2 has no default value.' . What is the
problem? Thanks.
Regards
updcomCompanies.Connection = dbConContacts
updcomCompanies.CommandText = "UPDATE tblClients SET Address_1 = ?,
Address_2 = ?, Address_3 = ?, Town " & _
"= ?, Company = ?, Country = ?, County = ?, Email = ?, Fax = ?, Postcode =
?, Tel" & _
" = ? WHERE (ID = ?) AND (Address_1 = ? OR ? IS NULL AND Address_1 IS NULL)"
& _
" AND (Address_2 = ? OR ? IS NULL AND Address_2 IS NULL) AND (Address_3 " &
_
"= ? OR ? IS NULL AND Address_3 IS NULL) AND (Town = ? OR ? IS NULL AND Town
I" & _
"S NULL) AND (Company = ? OR ? IS NULL AND Company IS NULL) AND (Country = ?
OR ?" & _
" IS NULL AND Country IS NULL) AND (County = ? OR ? IS NULL AND County IS
NULL) A" & _
"ND (EMail = ? OR ? IS NULL AND EMail IS NULL) AND (Fax = ? OR ? IS NULL AND
Fax " & _
"IS NULL) AND (Postcode = ? OR ? IS NULL AND Postcode IS NULL) AND (Tel = ?
OR ? " & _
"IS NULL AND Tel IS NULL)"
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address_1",
System.Data.OleDb.OleDbType.VarWChar, 64, "Address_1"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address_2",
System.Data.OleDb.OleDbType.VarWChar, 64, "Address_2"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address_3",
System.Data.OleDb.OleDbType.VarWChar, 64, "Address_3"))
updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Town",
System.Data.OleDb.OleDbType.VarWChar, 64, "Town"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Company",
System.Data.OleDb.OleDbType.VarWChar, 64, "Company"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Country",
System.Data.OleDb.OleDbType.VarWChar, 64, "Country"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("County",
System.Data.OleDb.OleDbType.VarWChar, 64, "County"))
updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Email",
System.Data.OleDb.OleDbType.VarWChar, 255, "Email"))
updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Fax",
System.Data.OleDb.OleDbType.VarWChar, 32, "Fax"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Postcode",
System.Data.OleDb.OleDbType.VarWChar, 8, "Postcode"))
updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Tel",
System.Data.OleDb.OleDbType.VarWChar, 32, "Tel"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ID",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"ID", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_1", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_11",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_1", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_2",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_2", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_21",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_2", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_3",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_3", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_31",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_3", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Town",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Town", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Town1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Town", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Company",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Company", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Company1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Company", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Country",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Country", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Country1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Country", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_County",
System.Data.OleDb.OleDbType.VarWChar, 64, System.Data.ParameterDirection.Inp
ut, False, CType(0, Byte), CType(0, Byte), "County",
System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_County1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"County", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Email",
System.Data.OleDb.OleDbType.VarWChar, 255,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Email", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Email1",
System.Data.OleDb.OleDbType.VarWChar, 255,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Email", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Fax",
System.Data.OleDb.OleDbType.VarWChar, 32,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Fax", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Fax1",
System.Data.OleDb.OleDbType.VarWChar, 32,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Fax", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Postcode",
System.Data.OleDb.OleDbType.VarWChar, 8,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Postcode", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Postcode1",
System.Data.OleDb.OleDbType.VarWChar, 8,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Postcode", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Tel",
System.Data.OleDb.OleDbType.VarWChar, 32,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Tel", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Tel1",
System.Data.OleDb.OleDbType.VarWChar, 32,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Tel", System.Data.DataRowVersion.Original, Nothing))
I am using this (below) code for update. The problem is that when I use
update I get the error 'Parameter ?_2 has no default value.' . What is the
problem? Thanks.
Regards
updcomCompanies.Connection = dbConContacts
updcomCompanies.CommandText = "UPDATE tblClients SET Address_1 = ?,
Address_2 = ?, Address_3 = ?, Town " & _
"= ?, Company = ?, Country = ?, County = ?, Email = ?, Fax = ?, Postcode =
?, Tel" & _
" = ? WHERE (ID = ?) AND (Address_1 = ? OR ? IS NULL AND Address_1 IS NULL)"
& _
" AND (Address_2 = ? OR ? IS NULL AND Address_2 IS NULL) AND (Address_3 " &
_
"= ? OR ? IS NULL AND Address_3 IS NULL) AND (Town = ? OR ? IS NULL AND Town
I" & _
"S NULL) AND (Company = ? OR ? IS NULL AND Company IS NULL) AND (Country = ?
OR ?" & _
" IS NULL AND Country IS NULL) AND (County = ? OR ? IS NULL AND County IS
NULL) A" & _
"ND (EMail = ? OR ? IS NULL AND EMail IS NULL) AND (Fax = ? OR ? IS NULL AND
Fax " & _
"IS NULL) AND (Postcode = ? OR ? IS NULL AND Postcode IS NULL) AND (Tel = ?
OR ? " & _
"IS NULL AND Tel IS NULL)"
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address_1",
System.Data.OleDb.OleDbType.VarWChar, 64, "Address_1"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address_2",
System.Data.OleDb.OleDbType.VarWChar, 64, "Address_2"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address_3",
System.Data.OleDb.OleDbType.VarWChar, 64, "Address_3"))
updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Town",
System.Data.OleDb.OleDbType.VarWChar, 64, "Town"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Company",
System.Data.OleDb.OleDbType.VarWChar, 64, "Company"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Country",
System.Data.OleDb.OleDbType.VarWChar, 64, "Country"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("County",
System.Data.OleDb.OleDbType.VarWChar, 64, "County"))
updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Email",
System.Data.OleDb.OleDbType.VarWChar, 255, "Email"))
updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Fax",
System.Data.OleDb.OleDbType.VarWChar, 32, "Fax"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Postcode",
System.Data.OleDb.OleDbType.VarWChar, 8, "Postcode"))
updcomCompanies.Parameters.Add(New System.Data.OleDb.OleDbParameter("Tel",
System.Data.OleDb.OleDbType.VarWChar, 32, "Tel"))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_ID",
System.Data.OleDb.OleDbType.Integer, 0,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"ID", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_1", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_11",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_1", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_2",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_2", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_21",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_2", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_3",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_3", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address_31",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address_3", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Town",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Town", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Town1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Town", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Company",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Company", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Company1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Company", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Country",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Country", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Country1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Country", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_County",
System.Data.OleDb.OleDbType.VarWChar, 64, System.Data.ParameterDirection.Inp
ut, False, CType(0, Byte), CType(0, Byte), "County",
System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_County1",
System.Data.OleDb.OleDbType.VarWChar, 64,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"County", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Email",
System.Data.OleDb.OleDbType.VarWChar, 255,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Email", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Email1",
System.Data.OleDb.OleDbType.VarWChar, 255,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Email", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Fax",
System.Data.OleDb.OleDbType.VarWChar, 32,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Fax", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Fax1",
System.Data.OleDb.OleDbType.VarWChar, 32,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Fax", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Postcode",
System.Data.OleDb.OleDbType.VarWChar, 8,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Postcode", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Postcode1",
System.Data.OleDb.OleDbType.VarWChar, 8,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Postcode", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Tel",
System.Data.OleDb.OleDbType.VarWChar, 32,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Tel", System.Data.DataRowVersion.Original, Nothing))
updcomCompanies.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Tel1",
System.Data.OleDb.OleDbType.VarWChar, 32,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Tel", System.Data.DataRowVersion.Original, Nothing))