By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,728 Members | 1,162 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,728 IT Pros & Developers. It's quick & easy.

Database update problems.

P: n/a
JM
Hi,

I am an old programmer who is only just getting back into it after about 10
years, and for the life of me I can not work out what I am doing wrong.

Firstly, I've recently downloaded and installed the very latest version of
VB.NET Express & SQL Express.

I have been slowly going through the suggested tutorial files on MSDN which
after from the learnvisualstudio.net web site :
http://msdn.microsoft.com/vstudio/ex...g/default.aspx

My problem is, with lessons 8 & 9 for anyone that may have watched,
completed them?

I can pretty much follow/understand everything. I can connect to the
database, look at records, add, delete, change etc. etc. etc. I can then
save the changes I've made - and confirm that the correct number of changes
were processed (by checking the returned value from my table adapter.update.

My problem is as soon as I quit, restard my application the previous changes
are gone and I'm back to my initial database.

I didn't think I'd post any code since it is identical to that of the
tutorials, but I can post it if you think it may help.

Hope this isn't too stupid a question, I am following things step for step
exactly. Any suggestions appreciated.


Apr 14 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
JM

"JM" <jm> wrote in message
news:44***********************@news.optusnet.com.a u...
Hi,

I am an old programmer who is only just getting back into it after about
10 years, and for the life of me I can not work out what I am doing wrong.

Firstly, I've recently downloaded and installed the very latest version of
VB.NET Express & SQL Express.

I have been slowly going through the suggested tutorial files on MSDN
which after from the learnvisualstudio.net web site :
http://msdn.microsoft.com/vstudio/ex...g/default.aspx

My problem is, with lessons 8 & 9 for anyone that may have watched,
completed them?

I can pretty much follow/understand everything. I can connect to the
database, look at records, add, delete, change etc. etc. etc. I can then
save the changes I've made - and confirm that the correct number of
changes were processed (by checking the returned value from my table
adapter.update.

My problem is as soon as I quit, restard my application the previous
changes are gone and I'm back to my initial database.

I didn't think I'd post any code since it is identical to that of the
tutorials, but I can post it if you think it may help.

Hope this isn't too stupid a question, I am following things step for step
exactly. Any suggestions appreciated.


I've continued to try and find out what I'm doing wrong....

Since my earlier message, I've downloaded the vb project file for lesson
nine on the above link, and i'm not surprised that is doens't work as it
does in the video of lesson 9.

Perhaps someone with 5 minutes to spare could download it and see if it
works for them. I'm going round in circles here.

Apr 14 '06 #2

P: n/a
On Fri, 14 Apr 2006 12:24:25 +1000, "JM" <jm> wrote:
Hi,

I am an old programmer who is only just getting back into it after about 10
years, and for the life of me I can not work out what I am doing wrong.

Firstly, I've recently downloaded and installed the very latest version of
VB.NET Express & SQL Express.

I have been slowly going through the suggested tutorial files on MSDN which
after from the learnvisualstudio.net web site :
http://msdn.microsoft.com/vstudio/ex...g/default.aspx

My problem is, with lessons 8 & 9 for anyone that may have watched,
completed them?

I can pretty much follow/understand everything. I can connect to the
database, look at records, add, delete, change etc. etc. etc. I can then
save the changes I've made - and confirm that the correct number of changes
were processed (by checking the returned value from my table adapter.update.

My problem is as soon as I quit, restard my application the previous changes
are gone and I'm back to my initial database.

I didn't think I'd post any code since it is identical to that of the
tutorials, but I can post it if you think it may help.

Hope this isn't too stupid a question, I am following things step for step
exactly. Any suggestions appreciated.

From MSDN:
One of the things to know when working with local database files is
that they are treated as any other content files. For desktop
projects, it means that by default, the database file will be copied
to the output folder (aka bin) each time the project is built.

1. If you select local database file in the Solution Explorer window,
you will see a property called ‘Copy to Output’ in the Properties
window. By default it is set to ‘Copy Always’ which means that on each
build, the data files in the project folder will be copied to the
output folder overwriting the existing data files if any. You can set
this property to Copy Never and then manually put a copy of the data
file in the output folder. This way, on subsequent builds, the project
system will leave the datafile in the output folder and not try to
overwrite it with the one from the project. The downside is that you
still have two copies so after you modify the database file using the
app, if you want to work on those changes in the project, you need to
copy it to the project manually and vise-versa.

2. You can leave the data file outside the project and create a
connection to it in Database Explorer. When the IDE asks you to bring
the file into the project, just say no. This way, both the design-time
and the run-time will be using the same data file but the downside is
that the path in the connection string will be hard coded and
therefore it’ll be harder to share the project and deploy the app.
Before deploying the app, just make sure to replace the full path in
the settings with a relative path.

Note: "Copy If Newer" seems a better option if not outside the
project.

Gene

Apr 14 '06 #3

P: n/a
JM

"gene kelley" <ok**@by.me> wrote in message
news:kp********************************@4ax.com...
On Fri, 14 Apr 2006 12:24:25 +1000, "JM" <jm> wrote:
Hi,

I am an old programmer who is only just getting back into it after about
10
years, and for the life of me I can not work out what I am doing wrong.

Firstly, I've recently downloaded and installed the very latest version of
VB.NET Express & SQL Express.

I have been slowly going through the suggested tutorial files on MSDN
which
after from the learnvisualstudio.net web site :
http://msdn.microsoft.com/vstudio/ex...g/default.aspx

My problem is, with lessons 8 & 9 for anyone that may have watched,
completed them?

I can pretty much follow/understand everything. I can connect to the
database, look at records, add, delete, change etc. etc. etc. I can then
save the changes I've made - and confirm that the correct number of
changes
were processed (by checking the returned value from my table
adapter.update.

My problem is as soon as I quit, restard my application the previous
changes
are gone and I'm back to my initial database.

I didn't think I'd post any code since it is identical to that of the
tutorials, but I can post it if you think it may help.

Hope this isn't too stupid a question, I am following things step for step
exactly. Any suggestions appreciated.


From MSDN:
One of the things to know when working with local database files is
that they are treated as any other content files. For desktop
projects, it means that by default, the database file will be copied
to the output folder (aka bin) each time the project is built.

1. If you select local database file in the Solution Explorer window,
you will see a property called 'Copy to Output' in the Properties
window. By default it is set to 'Copy Always' which means that on each
build, the data files in the project folder will be copied to the
output folder overwriting the existing data files if any. You can set
this property to Copy Never and then manually put a copy of the data
file in the output folder. This way, on subsequent builds, the project
system will leave the datafile in the output folder and not try to
overwrite it with the one from the project. The downside is that you
still have two copies so after you modify the database file using the
app, if you want to work on those changes in the project, you need to
copy it to the project manually and vise-versa.

2. You can leave the data file outside the project and create a
connection to it in Database Explorer. When the IDE asks you to bring
the file into the project, just say no. This way, both the design-time
and the run-time will be using the same data file but the downside is
that the path in the connection string will be hard coded and
therefore it'll be harder to share the project and deploy the app.
Before deploying the app, just make sure to replace the full path in
the settings with a relative path.

Note: "Copy If Newer" seems a better option if not outside the
project.

Gene



tvym.

I can only guess that something that has changed from the latest version and
the beta version which was used to create the tutorials. I don't know, but
if MS is trying to get a following from old VB6 programmers then maybe
making sure a feature tutorial for VB 2005 should be tested/updated a little
bit better.

You would not believe how many problems I've had just trying to get data
access to work, starting from VB 2003, which I gave up on in the end. Been
banging my head against a brick wall for so long, and in the end it was a 5
minute read of your post and a 10 second change to my project to get me
going again.

Again, thanks for the help.

Apr 14 '06 #4

P: n/a

"JM" <jm> wrote in message
news:44***********************@news.optusnet.com.a u...
My problem is as soon as I quit, restard my application the previous
changes are gone and I'm back to my initial database.


Usually that indicates you did not persist the changes to the DB but only to
the local copy of the records.

ADO.Net?


Apr 15 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.