O
One Handed Man
Its telling you that your dataDapter update command string is missing or
invalid. Check this
Here's one I cooked earlier
'setup People Update Command
peopleUpdateCmd.CommandText = "UPDATE People SET Address1 = ?, Address2 = ?,
Address3 = ?, Address4 = ?, Country" & _
" = ?, County = ?, DOB = ?, Email = ?, FirstName = ?, [Home Phone] = ?,
LastName " & _
"= ?, MiddleInnitial = ?, [Mobile Fone] = ?, [Post Code] = ?, Town = ? WHERE
(ID " & _
"= ?) AND (Address1 = ?) AND (Address2 = ?) AND (Address3 = ?) AND (Address4
= ?)" & _
" AND (Country = ?) AND (County = ?) AND (DOB = ?) AND (Email = ? OR ? IS
NULL AN" & _
"D Email IS NULL) AND (FirstName = ?) AND ([Home Phone] = ?) AND (LastName =
?) A" & _
"ND (MiddleInnitial = ? OR ? IS NULL AND MiddleInnitial IS NULL) AND
([Mobile Fon" & _
"e] = ? OR ? IS NULL AND [Mobile Fone] IS NULL) AND ([Post Code] = ?) AND
(Town =" & _
" ?)"
peopleUpdateCmd.Connection = con
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address1",
System.Data.OleDb.OleDbType.VarWChar, 50, "Address1"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address2",
System.Data.OleDb.OleDbType.VarWChar, 50, "Address2"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address3",
System.Data.OleDb.OleDbType.VarWChar, 50, "Address3"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address4",
System.Data.OleDb.OleDbType.VarWChar, 50, "Address4"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Country",
System.Data.OleDb.OleDbType.VarWChar, 50, "Country"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("County",
System.Data.OleDb.OleDbType.VarWChar, 50, "County"))
peopleUpdateCmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("DOB",
System.Data.OleDb.OleDbType.DBDate, 0, "DOB"))
peopleUpdateCmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("Email",
System.Data.OleDb.OleDbType.VarWChar, 50, "Email"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("FirstName",
System.Data.OleDb.OleDbType.VarWChar, 20, "FirstName"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Home_Phone",
System.Data.OleDb.OleDbType.VarWChar, 50, "Home Phone"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("LastName",
System.Data.OleDb.OleDbType.VarWChar, 20, "LastName"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("MiddleInnitial",
System.Data.OleDb.OleDbType.VarWChar, 3, "MiddleInnitial"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Mobile_Fone",
System.Data.OleDb.OleDbType.VarWChar, 50, "Mobile Fone"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Post_Code",
System.Data.OleDb.OleDbType.VarWChar, 10, "Post Code"))
peopleUpdateCmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("Town",
System.Data.OleDb.OleDbType.VarWChar, 50, "Town"))
peopleUpdateCmd.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))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address1", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address2",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address2", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address3",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address3", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address4",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address4", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Country",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Country", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_County",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"County", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DOB",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "DOB",
System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Email",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Email", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Email1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Email", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_FirstName",
System.Data.OleDb.OleDbType.VarWChar, 20,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"FirstName", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Home_Phone",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Home Phone", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_LastName",
System.Data.OleDb.OleDbType.VarWChar, 20,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"LastName", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_MiddleInnitial",
System.Data.OleDb.OleDbType.VarWChar, 3,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"MiddleInnitial", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_MiddleInnitial1",
System.Data.OleDb.OleDbType.VarWChar, 3,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"MiddleInnitial", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Mobile_Fone",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Mobile Fone", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Mobile_Fone1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Mobile Fone", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Post_Code",
System.Data.OleDb.OleDbType.VarWChar, 10,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Post Code", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Town",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Town", System.Data.DataRowVersion.Original, Nothing))
daPeople.UpdateCommand = peopleUpdateCmd
--
Regards - One Handed Man
Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.
invalid. Check this
Here's one I cooked earlier
'setup People Update Command
peopleUpdateCmd.CommandText = "UPDATE People SET Address1 = ?, Address2 = ?,
Address3 = ?, Address4 = ?, Country" & _
" = ?, County = ?, DOB = ?, Email = ?, FirstName = ?, [Home Phone] = ?,
LastName " & _
"= ?, MiddleInnitial = ?, [Mobile Fone] = ?, [Post Code] = ?, Town = ? WHERE
(ID " & _
"= ?) AND (Address1 = ?) AND (Address2 = ?) AND (Address3 = ?) AND (Address4
= ?)" & _
" AND (Country = ?) AND (County = ?) AND (DOB = ?) AND (Email = ? OR ? IS
NULL AN" & _
"D Email IS NULL) AND (FirstName = ?) AND ([Home Phone] = ?) AND (LastName =
?) A" & _
"ND (MiddleInnitial = ? OR ? IS NULL AND MiddleInnitial IS NULL) AND
([Mobile Fon" & _
"e] = ? OR ? IS NULL AND [Mobile Fone] IS NULL) AND ([Post Code] = ?) AND
(Town =" & _
" ?)"
peopleUpdateCmd.Connection = con
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address1",
System.Data.OleDb.OleDbType.VarWChar, 50, "Address1"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address2",
System.Data.OleDb.OleDbType.VarWChar, 50, "Address2"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address3",
System.Data.OleDb.OleDbType.VarWChar, 50, "Address3"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Address4",
System.Data.OleDb.OleDbType.VarWChar, 50, "Address4"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Country",
System.Data.OleDb.OleDbType.VarWChar, 50, "Country"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("County",
System.Data.OleDb.OleDbType.VarWChar, 50, "County"))
peopleUpdateCmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("DOB",
System.Data.OleDb.OleDbType.DBDate, 0, "DOB"))
peopleUpdateCmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("Email",
System.Data.OleDb.OleDbType.VarWChar, 50, "Email"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("FirstName",
System.Data.OleDb.OleDbType.VarWChar, 20, "FirstName"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Home_Phone",
System.Data.OleDb.OleDbType.VarWChar, 50, "Home Phone"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("LastName",
System.Data.OleDb.OleDbType.VarWChar, 20, "LastName"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("MiddleInnitial",
System.Data.OleDb.OleDbType.VarWChar, 3, "MiddleInnitial"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Mobile_Fone",
System.Data.OleDb.OleDbType.VarWChar, 50, "Mobile Fone"))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Post_Code",
System.Data.OleDb.OleDbType.VarWChar, 10, "Post Code"))
peopleUpdateCmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("Town",
System.Data.OleDb.OleDbType.VarWChar, 50, "Town"))
peopleUpdateCmd.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))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address1", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address2",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address2", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address3",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address3", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Address4",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Address4", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Country",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Country", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_County",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"County", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_DOB",
System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input,
False, CType(0, Byte), CType(0, Byte), "DOB",
System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Email",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Email", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Email1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Email", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_FirstName",
System.Data.OleDb.OleDbType.VarWChar, 20,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"FirstName", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Home_Phone",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Home Phone", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_LastName",
System.Data.OleDb.OleDbType.VarWChar, 20,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"LastName", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_MiddleInnitial",
System.Data.OleDb.OleDbType.VarWChar, 3,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"MiddleInnitial", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_MiddleInnitial1",
System.Data.OleDb.OleDbType.VarWChar, 3,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"MiddleInnitial", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Mobile_Fone",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Mobile Fone", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Mobile_Fone1",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Mobile Fone", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Post_Code",
System.Data.OleDb.OleDbType.VarWChar, 10,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Post Code", System.Data.DataRowVersion.Original, Nothing))
peopleUpdateCmd.Parameters.Add(New
System.Data.OleDb.OleDbParameter("Original_Town",
System.Data.OleDb.OleDbType.VarWChar, 50,
System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte),
"Town", System.Data.DataRowVersion.Original, Nothing))
daPeople.UpdateCommand = peopleUpdateCmd
--
Regards - One Handed Man
Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.
john said:hi
im trying to update a dataset
DataRow r = ds.Tables["customer"].NewRow();
r["Name"]="customer1";
ds.Tables["customer"].Rows.Add(r);
da.Update(ds,"customer");
when i run
da.Update(ds,"customer");
this piece of code i get the following error
Update requires a valid InsertCommand when passed DataRow collection with
new rows.
i can see the updated data in the dataset but i cant update it to the sql
2000 database.
thank you for your time