Hi all,
im totaly new to forums and this is my first post ever to please excuse if the form isn't correct.
I have big problems to understand the complete correlation of dataset, dataadapter and so on.
My Exact problem:
I have an access Database from where I want to read some data, give the user the possibility to change and write back to tha Database.
My actual Try:
String myConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\\Projekte\\Vstudio\\WebSites\\Freischalt ung\\db\\P_AC.mdb";
// Object erzeugen
OleDbConnection myConnection = new OleDbConnection(myConnectionString);
//Verbindung öffnen
myConnection.Open();
//SQL statement in Variable
OleDbDataAdapter myAdapter = new OleDbDataAdapter();
string mySelect = "SELECT [LfdNr], [KdNr], [Firma] ,[Anrede] FROM [Aktivierungen] WHERE ([LfdNr] = 1)";
myAdapter.SelectCommand = new OleDbCommand(mySelect, myConnection);
string mywrite = "UPDATE [Aktivierungen] SET LfdNr=?, KdNr=?, Firma=?, Anrede=? WHERE ([LfdNr] = 1)" ;
//string mywrite = "UPDATE Aktivierungen SET LfdNr = @LfdNr, KdNr = @KdNr, Firma = @Firma,Anrede = @Anrede WHERE (LfdNr = 1)";
myAdapter.UpdateCommand = new OleDbCommand(mywrite, myConnection);
DataSet mydataset = new DataSet();
myAdapter.Fill(mydataset,"Aktivierungen");
mydataset.Tables["Aktivierungen"].Rows[0]["KdNr"] = "12345";
myAdapter.Update(mydataset, "Aktivierungen");
When I try this I get the Errormessage:
Für mindestens einen erforderlichen Parameter wurde kein Wert angegeben
(translated: for at least one necessary parameter was no value given)
I try to find a solution since about 2 days and tried all forums and books I can find but up to now nothing helps.