Monday, March 19, 2012

I update SqlExpress database but i don't see the records

Hi everybody! I 'm facing a strange problem and i hope someone could help me understand what i'm doing wrong.

The situation has as follows:

1. I make a new windows project in VB .Net 2005 and add a listbox to form1

2. With "Add new Item" from the solution explorer I add a new Sql Database from the templates to the project (e.g. MyDatabase1.mdf)

3. I add a table to the SQL Database e.g. Books - with 2 only fields (BookID and BookDescription) and I add some records to the table

4. I add a new DataSource to the project and I bind the LIstBox to the table Books.

5. I add two buttons to the project. Button1 adds a new book, Button2 gives me record by record the books in the table (e.g. 1-Vb for begginers, 2-.Net for begginers etc.)

6. I Run the project and I add a new record to the table through button1. With button2 I confirm the record is added to the table (3-Vb for me)

Till here, everything works fine...

7. I close the project. I open the table Books to see for the new record (VB for me). There is no record in the Database!

Any idea?

P.S. I've done all possible ways to add the new record (with tableadapter and with a SqlCommand). In both ways the record in runtime is added to the table and it can be confirmed.

But when I close the project and try to find it , there is no record at all!

Hi,

make sure you call the update method on your SQLDataAdapter. Otherwise the data won′t be updated though the Dataset you are working with a in its normal "disconnected" mode.

HTH, Jens Suessmeyer.


http://www.sqlserver2005.de

|||

Thanks for the suggestion but of cource and i do call the update method. As I told you I can confirm that the records have been inserted.

The point is that I cannot see the records when I close the project

|||Why do you think you got a confirmation ?

No comments:

Post a Comment