|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Database update problems.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/express/vb/learning/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.
Show quote
Hide quote
"JM" <jm> wrote in message I've continued to try and find out what I'm doing wrong....news:443f07da$0$10675$afc38c87@news.optusnet.com.au... > 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/express/vb/learning/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. > 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.
Show quote
Hide quote
On Fri, 14 Apr 2006 12:24:25 +1000, "JM" <jm> wrote: From MSDN:>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/express/vb/learning/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. > 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 Show quoteHide quote > > >
Show quote
Hide quote
"gene kelley" <o***@by.me> wrote in message tvym.news:kpou321jmpelpsthnf0k1cgd96l4prvcc1@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/express/vb/learning/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 >> >> >> 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. "JM" <jm> wrote in message Usually that indicates you did not persist the changes to the DB but only to news:443f07da$0$10675$afc38c87@news.optusnet.com.au... > My problem is as soon as I quit, restard my application the previous > changes are gone and I'm back to my initial database. the local copy of the records. ADO.Net?
How to release a free source code?
Dynamically open forms, reports or call functions .NET 1.1 app runs on .NET 2.0? Warning Text Files Access Crystal "PrintToPrinter" will not print to Zebra Label Printer... HELP! Duplicate controls on tab pages How to convert a regular VB app into a service to run on a Windows 2003 server? IO.File.AppendText error Crypto Question FileUpload to SQL |
|||||||||||||||||||||||