Vb net dataset not updating

Below is a listing of my code for the combobox selected Index Changed event which I use, essentially, to repopulate the datagridview.

private void cb Table Select_Selected Inde My problem is that the datatable shema is constantly changing based on what table is selected from the database (they all have different columns and, of course, rows associated with them).

Identity Seed and Identity Increment are set as 1 by default as shown in Figure 1 below.

, or by adding a Data Set and then dragging and dropping My Customer from Server Explorer to the Data Set Designer.

However, if you select another table and then come back to the previous table, the datagridview only displays the column headings and not any of the rows of data.

I have been searching for a solution to this problem for 2 hours with no luck.

Once I added in that piece of information things started working fine again.

If you have an identity primary key column defined in a database table, its value will be automatically set by the database engine when you insert a new row to the table.

vb net dataset not updating-90

This is an approach to ensure that the placeholder values that ADO.

I am hoping for either a better solution or at least and explanation as to why the dt.reset() causes this problem. As far as i have understood you are making differnt queries from differnt tables. Clear() method it only Clears the rows assosicated with the columns(i.e the columns from the Data Set Object). What you have to do is to set the Data Source Value again to the other Table.

You get the data from the SQL Server and then set the data in a Data Set; This data Set Object is then added to the bs. So To summarize set the Data Source Property again. I believe I understand what you are saying but a sample might be prudent to be sure I implement it correctly the first time.

I would also like to point out that I am using a datatable and not a dataset.

I would populate a dataset with all the tables and all the information but this, in the long run, will be extremely slow as the data in the database starts to grow. Consider the Following: static SQLData Adapter Get Data Set For Table(string Table Name) bs. Data Source = SQLData I wasn't using a Dataset because I was only getting a single table from the database so it seemed like 'overkill' to me to use the dataset structure.

Leave a Reply