dataadapter

Why it doesn't save changes into datatable from datagridview?

北城余情 提交于 2019-12-05 18:50:22
I have binded datagridview with datatable ( Growns ). My main goal is, that user can work with datagridview ( dataGridView1 ), filling and updating data and when button SAVE is clicked, all data would be saved into datatable, because I need it for further work. Everything works fine, exept saving data into datatable . What am I doing wrong? Here is my code: private void Form2_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'tekmovalecDataSet.Odrasli' table. You can move, or remove it, as needed. this.grownsTableAdapter.Fill(this.competitorDataSet.Odrasli); }

SqlDataAdapter.Fill() Timeout - Underlying Sproc Returns Quickly

徘徊边缘 提交于 2019-12-05 14:13:29
I have a SqlDataAdapter that is being populated with 21 rows of data (4 columns). The sproc that drives it returns in a couple seconds in SQL Mgmt Studio, but the .Fill() takes 5 minutes. ArrayList ret = new ArrayList(); SqlDataAdapter da = null; SqlCommand cmd = null; cmd = base.GetStoredProc("usp_dsp_Stuff"); //Returns immediately in MSSMS. cmd.CommandTimeout = 3600; // Set to 6 min - debug only base.AddParameter(ref cmd, "@Param1", ParameterDirection.Input, SqlDbType.BigInt, 8, 19, 0, theParam1); base.AddParameter(ref cmd, "@Param2", ParameterDirection.Input, SqlDbType.BigInt, 8, 19, 0,

Reload data using TableAdapter

梦想的初衷 提交于 2019-12-05 13:11:32
private void UserList_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'workOrdersDataSet.users' table. You can move, or remove it, as needed. this.usersTableAdapter.Fill(this.workOrdersDataSet.users); } How can I reload the data if changes were made in another form? (preferably automatically without using a Refresh button)? I am using WinForms and the backend is Access 2007. The data is bound using the Designer to a Datagrid First, I would move the Fill to a separate function: public void LoadData() { this.usersTableAdapter.Fill(this.workOrdersDataSet.users);

Update using MySqlDataAdapter doesn't work

好久不见. 提交于 2019-12-05 10:14:18
I am trying to use MySqlDatAdapter to update a MySql table. But, the table never updates!!! I did this before but with SQL server. Is there anything else that is specific to MySql that I am missing in my code? DataTable myTable = new DataTable("testtable"); MySqlConnection mySqlCon = new MySqlConnection(ConfigurationManager.ConnectionStrings["DBConStr"].ConnectionString); MySqlCommand mySqlCmd = new MySqlCommand("SELECT * FROM testtable WHERE Name = 'Tom'"); mySqlCmd.Connection = mySqlCon; MySqlDataAdapter adapter = new MySqlDataAdapter(mySqlCmd); MySqlCommandBuilder myCB = new

DataAdapter.Fill too slow

拜拜、爱过 提交于 2019-12-05 01:49:59
问题 I know DataAdapters have performance issues, but are there any ways around it that might be faster? At the moment, the DataAdapter.Fill method is taking 5-6 seconds on 3000 records, which is too slow for my app. If I remove the Fill line and just execute the SQL (using SQLCE), it takes 20 milliseconds, so I'm guessing the query isn't the problem. I've tried adding BeginLoadData on the datatable, but it makes no difference to the performance. using (SqlCeConnection con = new SqlCeConnection

DataAdapter.Update() does not Update the Database

故事扮演 提交于 2019-12-03 18:00:21
问题 I'm sure there is an extremely simple reason that this one line isn't working, but it has evaded for the past week, so I'm hoping someone else will notice my fault. I have been working on this project for several weeks to a month. I have been using a mix of old DataAdapter, CommandBuiler, etc. with some linq to sql coding on 1 database, with multiple windows application forms. This particular form Edits or Deletes rows from the Database using a DataAdapter, Dataset, and Command Builder. It

DataAdapter.Fill too slow

谁说胖子不能爱 提交于 2019-12-03 16:28:38
I know DataAdapters have performance issues, but are there any ways around it that might be faster? At the moment, the DataAdapter.Fill method is taking 5-6 seconds on 3000 records, which is too slow for my app. If I remove the Fill line and just execute the SQL (using SQLCE), it takes 20 milliseconds, so I'm guessing the query isn't the problem. I've tried adding BeginLoadData on the datatable, but it makes no difference to the performance. using (SqlCeConnection con = new SqlCeConnection(conString)) { con.Open(); using (SqlCeDataAdapter dAdapter= new SqlCeDataAdapter()) { using (SqlCeCommand

Concurrency violation: the UpdateCommand affected 0 of the expected 1 records. DB concurrencyException was unhandled

浪尽此生 提交于 2019-12-02 08:37:56
i have defined 2 datasets and 2 dataAdapters( one for each of the datasets ) . after creating, for each of the 2 dataAdapters i define a SqlCommandBuilder. All is well till here. I can add, modify, erase very ok from the database using dataAdapter1.Update(dataSet1) .. BUT not in this order :erase, add,modify. Here is the code for the first dataset,dataAdapter and sqlCommandBuilder : string sql = "SELECT * From localitati"; da1 = new System.Data.SqlClient.SqlDataAdapter(sql, con); da1.Fill(ds1, "localitati"); cmdBuilder1 = new SqlCommandBuilder(da1); And the second : sql = "SELECT * From

SqlDataAdapter.Fill() within a SqlTransaction - is this a bad practice?

試著忘記壹切 提交于 2019-12-02 05:16:46
Since I have a "DB util" class with a DataSet QueryDB(string spName, DBInputParams inputParams) method which I use for all my calls to the database, I would like to reuse this method in order to support transacted calls. So, at the end I will have a SqlDataAdapter.Fill within a SqlTransaction. Will this be a bad practice? Because rarely I see usage of DataAdapter.Fill within a transaction and more often ExecuteReader(). Is there any catch? Edit1: The thing is that inside my transaction is often needed to retrieve also some data (e.g auto-IDs)... that's why I would like to get it as DataSet.

SQLiteDataAdapter Update method returning 0

瘦欲@ 提交于 2019-11-30 17:54:50
问题 I loaded 83 rows from my CSV file, but when I try to update the SQLite database I get 0 rows... I can't figure out what I'm doing wrong. The program outputs: Num rows loaded is 83 Num rows updated is 0 The source code is: public void InsertData(String csvFileName, String tableName) { String dir = Path.GetDirectoryName(csvFileName); String name = Path.GetFileName(csvFileName); using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dir + @";Extended