I have a database called DB.mdf, in my program I use this code to insert a new row in this database:
DBDataSet ds = new DBDataSet();
DBDataSetTableAdapters.IPTableAdapter ipadap = new DBDataSetTableAdapters.IPTableAdapter();
ipadap.InsertQuery(ip);
InsertQuery is: INSERT INTO [IP] ([ID], [indirizzo]) VALUES (0, @indirizzo);
The program executes all steps, but not inserts the row on database. Why?
UPDATE Now I have tried this code:
DBDataset.IPRow newRegionRow;
newRegionRow = db.IP.NewIPRow();
newRegionRow.ID = "6";
newRegionRow.indirizzo = "NorthWestern";
// Add the row to the Region table
this.db.IP.Rows.Add(newRegionRow);
// Save the new row to the database
this.ipadap.Update(this.db.IP);
And in this case not write a new row in database
I have found the error!!! I didn't know that Visual Studio, during develop, create a copy of database in /bin and it work with the copy of database.
Thanks to all.