Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating and Inserting
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00859538
Message ID:
00859800
Vues:
12
Hello Richard,

let me have a two tries:

1. You should (also with Access) be able to use named Parameters, perhaps that helps to unconfuse the .NET:
string selectSQL = "UPDATE Employees SET
   Address = <b>@adress</b>, BirthDate = <b>@brithday</b>, City = <b>@city</b>, Country = @country, ...
WHERE     (EmployeeID = @employeeID)"

and then you need:
...
// SelectCommandObject to work with Parameters
OleDbCommand selectCMD = new OleDbCommand(selectSQL, con);
adapter.SelectCommand = selectCMD;

// Add parameters and set values.
selectCMD.Parameters.Add("@adress", <b>OleDbType.VarChar</b>, 30).Value = "What ever";
selectCMD.Parameters.Add("@City", <b>OleDbType.VarChar</b>, 30).Value = "London";
2. Actually in there in there already is the second suggestion. Is the data type for the EmployeeID OK ? Perhaps you need to use a differnt one, I am no really familiar with access, so just a guess.

Marcus


>I don't understand why my update code isn't updating (and my insert code isn't inserting)...
>Can someone explain to me why?
>
>I have a form where I let the DataAdapter wizard create to code to update the Northwind Employees table.
>On my form I display all the fields of the table.
>I edit the last name field changing "Brown" into "Brown_10"
>I supply parameter statements for all the fields (except EmployeeID - when I supply that one I get an error saying it's not part of the parameters collection - why is that????)
>
>Here's my wizard generated DataAdapter Update code
Marcus Alt
TRIA IT-Consulting GmbH
Working hard | for your success
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform