VB 2005 express database problems

J

just_out_for_fun

Hi, hope you guys can help.

I have set up a simple one table db to play with using VB express and
the form sees data already entered but when I use the save button on
the form it does not change or add any of the new records.

BTW I used the wizard to drag the table from data sources window which
adds several properties to the form.

Any ideas why the DB lets you see the data but will not accept updates?

Your help is appreciated.
 
C

Cor Ligthert [MVP]

Just,

As you have used the datasource wizard, than it creates a single user update
function for you , therefore with this information nobody can help you. You
should have done something extra that we do'nt know

Cor
 
G

gene kelley

Hi, hope you guys can help.

I have set up a simple one table db to play with using VB express and
the form sees data already entered but when I use the save button on
the form it does not change or add any of the new records.

BTW I used the wizard to drag the table from data sources window which
adds several properties to the form.

Any ideas why the DB lets you see the data but will not accept updates?

Your help is appreciated.

Run the .exe file in the bin/debug folder, or the .exe file in the
bin/release folder if you have generated a build. Make some changes to
the db and save. When you rerun the .exe, you should see the changes.
If so, then read this:

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top