tableadapter

Control TableAdapter Command Timeout Globally

北慕城南 提交于 2019-11-29 22:31:53
问题 I have a DataSet with a QueriesTableAdapter. In order to control the SqlCommand.CommandTimeout I've added a partial class called QueriesTableAdapter with a public method called ChangeTimeout. partial class QueriesTableAdapter { public void ChangeTimeout(int timeout) { foreach (System.Data.SqlClient.SqlCommand cmd in CommandCollection) { cmd.CommandTimeout = timeout; } } } For every DataSet I have that has a QueriesTableAdapter, I can set the CommandTimeout prior to executing. using (NameSpace

Saving Dataset to database

与世无争的帅哥 提交于 2019-11-29 05:15:42
I am trying to save a dataset to a database. I got a dataset from another class, Now changes will be made on the form by a user on a datagridview, then the changed Dataset needs to be saved in the database. I am using the below code; Its not generating any errors, but the data is not being saved in the database. public class myForm { DataSet myDataSet = new DataSet(); public void PouplateGridView() { try { SqlService sql = new SqlService(connectionString); // Valid Connection String, No Errors myDataSet = sql.ExecuteSqlDataSet("SELECT * FROM Qualification"); // Returns a DataSet myDataGridView

Getting @@IDENTITY from TableAdapter

一笑奈何 提交于 2019-11-28 05:33:18
问题 I am trying to complete a seemingly simple task that has turned into a several hour adventure: Getting @@Identity from TableAdapter.Insert() . Here's my code: protected void submitBtn_Click(object sender, EventArgs e) { AssetsDataSetTableAdapters.SitesTableAdapter sta = new AssetsDataSetTableAdapters.SitesTableAdapter(); int insertedID = sta.Insert(siteTxt.Text,descTxt.Text); AssetsDataSetTableAdapters.NotesTableAdapter nta = new AssetsDataSetTableAdapters.NotesTableAdapter(); nta.Insert

Saving Dataset to database

给你一囗甜甜゛ 提交于 2019-11-27 18:56:40
问题 I am trying to save a dataset to a database. I got a dataset from another class, Now changes will be made on the form by a user on a datagridview, then the changed Dataset needs to be saved in the database. I am using the below code; Its not generating any errors, but the data is not being saved in the database. public class myForm { DataSet myDataSet = new DataSet(); public void PouplateGridView() { try { SqlService sql = new SqlService(connectionString); // Valid Connection String, No

How to delete a selected DataGridViewRow and update a connected database table?

谁说胖子不能爱 提交于 2019-11-27 11:26:27
I have a DataGridView control on a Windows Forms application (written with C#). What I need is: when a user selects a DataGridViewRow, and then clicks on a 'Delete' button, the row should be deleted and next, the database needs to be updated using table adapters. This is what I have so far: private void btnDelete_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count > 0) { dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[0].Index); } } Furthermore, this only deletes one row. I would like it where the user can select multiple rows. This code removes selected

Update requires a valid UpdateCommand when passed DataRow collection with modified rows

不打扰是莪最后的温柔 提交于 2019-11-27 02:04:31
So I had this working last week. At least, I thought I did! DataGridView Update Then I start working on the project again today and am getting Update requires a valid UpdateCommand when passed DataRow collection with modified rows. On scDB.SSIS_Configurations_StagingDataTable table = (scDB.SSIS_Configurations_StagingDataTable)stagingGrid.DataSource; myStagingTableAdapter.Update(table); The StagingTableAdapter has an additional query which takes 'filter' as a parameter. That was used to fill the DataGridView . In the wizard for creating that query I see 'update was generated'. I see that most

How to delete a selected DataGridViewRow and update a connected database table?

╄→尐↘猪︶ㄣ 提交于 2019-11-26 22:20:25
问题 I have a DataGridView control on a Windows Forms application (written with C#). What I need is: when a user selects a DataGridViewRow, and then clicks on a 'Delete' button, the row should be deleted and next, the database needs to be updated using table adapters. This is what I have so far: private void btnDelete_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count > 0) { dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedRows[0].Index); } } Furthermore, this only

Update requires a valid UpdateCommand when passed DataRow collection with modified rows

為{幸葍}努か 提交于 2019-11-26 09:53:43
问题 So I had this working last week. At least, I thought I did! DataGridView Update Then I start working on the project again today and am getting Update requires a valid UpdateCommand when passed DataRow collection with modified rows. On scDB.SSIS_Configurations_StagingDataTable table = (scDB.SSIS_Configurations_StagingDataTable)stagingGrid.DataSource; myStagingTableAdapter.Update(table); The StagingTableAdapter has an additional query which takes \'filter\' as a parameter. That was used to fill