473,803 Members | 3,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding data to database

Hello
I am currently learning VB.net and I am using the tutorial on VB
express. One of the tutorials is about adding a database and then
creating a visual input or amendment screen but event though I have
followed the tutorial and even redone all the steps I cannot get the
input to save into the data below is the code that currently exists
against the form.

Public Class Form1

Private Sub AddressBookBind ingNavigatorSav eItem_Click(ByV al sender
As System.Object, ByVal e As System.EventArg s) Handles
AddressBookBind ingNavigatorSav eItem.Click
Me.Validate()
Me.AddressBookB indingSource.En dEdit()

Me.AddressBookT ableAdapter.Upd ate(Me.Database 1DataSet.Addres sBook)
End Sub

Private Sub Form1_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing

Me.AddressBookB indingSource.En dEdit()

Me.AddressBookT ableAdapter.Upd ate(Me.Database 1DataSet.Addres sBook)
End Sub

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'TODO: This line of code loads data into the
'Database1DataS et.AddressBook' table. You can move, or remove it, as
needed.

Me.AddressBookT ableAdapter.Fil l(Me.Database1D ataSet.AddressB ook)

End Sub
End Class

Mar 14 '06 #1
4 1571
On 14 Mar 2006 06:16:40 -0800, "tr************ @za.syspro.com"
<tr************ @za.syspro.com> wrote:
Hello
I am currently learning VB.net and I am using the tutorial on VB
express. One of the tutorials is about adding a database and then
creating a visual input or amendment screen but event though I have
followed the tutorial and even redone all the steps I cannot get the
input to save into the data below is the code that currently exists
against the form.

Public Class Form1

Private Sub AddressBookBind ingNavigatorSav eItem_Click(ByV al sender
As System.Object, ByVal e As System.EventArg s) Handles
AddressBookBin dingNavigatorSa veItem.Click
Me.Validate()
Me.AddressBookB indingSource.En dEdit()

Me.AddressBook TableAdapter.Up date(Me.Databas e1DataSet.Addre ssBook)
End Sub

Private Sub Form1_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows .Forms.FormClos ingEventArgs) Handles Me.FormClosing

Me.AddressBookB indingSource.En dEdit()

Me.AddressBook TableAdapter.Up date(Me.Databas e1DataSet.Addre ssBook)
End Sub

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventAr gs) Handles MyBase.Load
'TODO: This line of code loads data into the
'Database1Data Set.AddressBook ' table. You can move, or remove it, as
needed.

Me.AddressBook TableAdapter.Fi ll(Me.Database1 DataSet.Address Book)

End Sub
End Class

Run the .exe file in the project's bin\debug folder a couple of times.
You should see saved changes.

The two lines in the FormClosing event are not necessary.

Gene
Mar 14 '06 #2
Hello Gene
Thank you for the help but could you probably give me a short
explaination as to why if I run the exe from with the bin/debug folder
will the changes be saved whereas if I do this from within the IDE the
changes do not get saved?
I did read something about the properties option to copy to output
directory that will allow the changes to be saved.

Mar 15 '06 #3
On 15 Mar 2006 03:48:17 -0800, "tr************ @za.syspro.com"
<tr************ @za.syspro.com> wrote:
Hello Gene
Thank you for the help but could you probably give me a short
explaination as to why if I run the exe from with the bin/debug folder
will the changes be saved whereas if I do this from within the IDE the
changes do not get saved?
I did read something about the properties option to copy to output
directory that will allow the changes to be saved.


The changes do actually get saved when running from within the IDE.
However, by default, the database file's property, Copy To Output
Directory, is "Copy Always". So, each time you run the project in the
IDE, the last working database file in the bin/debug folder gets
overwritten with the original database file, hence, it appears that
previous changes were not saved. The same applies with builds. Each
time you make a build, the original database file is copied to the
bin/release folder.

Changing "Copy Always" to Copy If Newer" will allow saved changes to
show when running in the IDE unless changes are made to the original
database file. If you are going to distribute the app, you need to
keep in mind whether you want the original or "current" database file
in the release.

Gene
Mar 15 '06 #4
Hello Gene
I do understand the concept and I have got it to work and as you
mentioned in your last statement the original database is being viewed
instead of the current. How can I change this?
Thanks for you time and help.

Mar 16 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
14414
by: Bobbak | last post by:
Hello All, I have these tables (lets call it ‘EmpCalls', ‘EmpOrders', and ‘Stats') that each contain the list of EmployeeIDs, I want to be able to create a Module in which I could call in my VB form (by clicking and command button)that will add a column (field) to each table and label it with the current date that is specified in my form. Does anyone know how I can go about doing this? Any suggestion will be greatly appreciated.
3
4889
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
3
1957
by: Robin Thomas | last post by:
I am fairly new to ASP.NET so I think I am missing something fundamental. Anyway, quite often I am pulling data from a database, but then I need to use that data to produce more data. A simple example would be: Let's say Column1=StartDate and Column2=EndDate. In addition to displaying Column1 and Column2, I need to do some calculations and display in as Column3. The calculations are easy and can be done in the code-behind. How to display...
1
3299
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple days of struggling, I figure asking you all (the experts) will keep me from going down some dark and dangerous road. The project I have is a fairly simple one, in theory anyway. The gist is to create a page where the user enters an IDNumber,...
10
2359
by: Trevor | last post by:
Hey, I am trying to do this tutorial on the microsoft site : http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dndotnet/html/usingadonet.asp I can get everything to work up to the DataAdd part (Section heading is Adding Rows to a DataSet) I dont really know what to do after i have added all the
5
1552
by: Neo Geshel | last post by:
Greetings. I am in a very big pickle. I am trying to add page content - as well as a submit button - programatically to a web form that is supposed to submit to DB and then refresh. That is, a user goes to the web page, which draws the current content out of the db and inserts into a "preview" area as well as the form itself. User makes changes, hits submit button. The page *should* refresh, with the changes saved to the db, and...
9
2785
by: Neo Geshel | last post by:
I have strip-mined, strip-searched, and completely exhausted the Internet (up to the 30th page on Google, with 100 results per page!!), all without finding an answer to my question AS TO WHY IT IS IMPOSSIBLE TO PROGRAMMATICALLY ADD A BUTTON TO A DYNAMICALLY CREATED PAGE. Or, to be more precise, why it is impossible to have an onClick sub respond to that button’s Click event. My main page has only one line:
12
6228
by: JMO | last post by:
I can import a csv file with no problem. I can also add columns to the datagrid upon import. I want to be able to start importing at the 3rd row. This will pick up the headers necessary for the datagrid. Once I can get to that point I need some way to be able to add new data only to the new columns that were added. Here is some of my code: //Function For Importing Data From CSV File public DataSet ConnectCSV(string filetable)
2
15076
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have been able to find the cause of the problem, and will describe it here first textually and then through a code example. The purpose of what I am trying to do is to create a postback-free web application through the use of ASP.net AJAX UpdatePanels...
0
1969
by: ganesh22 | last post by:
Hi... Iam using GridView in asp.net(2.0) .My requirement is user can add,update,delete in gridview I written the code for add & update but can u help adding rows in grid view My code: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3" Height="237px" Style="z-index: 100; left: 155px; position: absolute; top: 132px" Width="688px" BackColor="White" BorderColor="#CCCCCC"...
0
10548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.