Reputation: 27
I created a program that requires a database and I am using Visual Studio and SQL Server to do it.
My problem is that I cannot update my table. I found the solution here.
My code is below:
this.customersTableAdapter.Update(this.northwindDataSet.Customers);
tabelAdapter.Update(ABCDatabaseDataSet**.Barber)**;
But it gives me an error that the ABCDatabaseDataSet
does not have Barber
. There is just BarberDataTable
or BarberRow
there is not a Barber
table.
What am I doing wrong?
Upvotes: 1
Views: 148
Reputation: 3563
Your probably best off doing this with ADO or better LINQ. Heres an ADO example:
var thisConnection = new SqlConnection("Server=ServerIP/Name;Data Source=Database;Initial Catalog=Database;User ID=User;Password=Pass;Trusted_Connection=False");
thisConnection.Open();
var updateSql1 = "UPDATE dbo.Customer " +
"SET barber = 'I Barber People !' " +
"WHERE customerID = 5";
var UpdateCmd1 = new SqlCommand(updateSql1, thisConnection);
UpdateCmd1.ExecuteNonQuery();
thisConnection.Close();
Too much to place here but here is a good Linq (database) tutorial tutorial
Upvotes: 1