Description:
First forgive me i am new to MYSQL I am converting a project from MSSQL. IN MSSQL when you add a new table adapter the "refresh the data table" is default checked. This lead me to think it not being checked is causing this bug.
The reason i want to do this is so after an update to the database in my code i can get the new auto generated index. Here's some code.
dsJob.jobtblRow[] JobRows = (dsJob.jobtblRow[])m_dtJobs.Select("ID = " + lID);
foreach (dsJob.jobtblRow JobRow in JobRows)
{
fProgress.UpdateProgressBox("", "Saving Job Data...");
lOldJobID = JobRow.ID; //saving the old ID
JobRow.EndEdit(); //make sure not editing
m_taJobs.Update(JobRow); //update the table adapter
JobRow.AcceptChanges(); //accept the changes
lNewJobID = JobRow.ID; //get the new auto incremented ID
}
Using MSSQL after the AcceptChanges the JobRow.ID get updated to the new auto generated one. But in MySQL its still -1.
Am I doing something wrong or is there a work around?
How to repeat:
have a MySQL database ready. World default will work.
- Open VS 2010 and create a new Visual C# Windows Form Application project.
- Add a new DataSet to the project.
- Using the Server Explorer right click data connections and add connections...
- select MySQL database.
- Fill in server name, user id, password and database name(World). Check "Save my password" and click OK.
- Expand the server in server explorer.
- expand the database(World)
- drag adn drop any of the tables to the dataset.
- right click on the datatable and select configure..
- click on the advanced options
- check refresh the data table
- ckick ok.
- click finish.
- reopen it and go to the advanced options - not checked