List Info

Thread: Save data to database




Save data to database
user name
2006-09-06 00:40:29
That is why I placed the square brackets around the word
name. Take
another look.

-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of King,
Michael A
Sent: Tuesday, September 05, 2006 7:00 PM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Save data to database


Bill,
Thanks for the suggestion, but that is what I am doing.  I
have confused
it a bit with my table name which is actually
"name". Cheers, 


Michael King
> 
>*Phone: 08 8282 4440
>

-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of Booth,
Bill
Sent: Wednesday, 6 September 2006 1:53 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Save data to database

This is nothing more than a guess, try something like this.

Me.NameTableAdapter.Update(Me.TestDatabaseDataSet.[name])

-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of King,
Michael A
Sent: Sunday, September 03, 2006 19:28
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: [VBDOTNET] Save data to database


Hello,

Please forgive me if this is a really obvious question.

I am just starting to explore Visual Studio 2005 and am
having a problem
saving records to a database. I have created a very simple
project using
1 form and I set up a database using the create new
datasource wizard. I
created 1 table (by right clicking on the tables folder in
the server
explorer window)

I then simply dragged the table from the Data Sources window
onto my
form where it created a grid for me along with a navigator,
table
adaptor, etc.

Here is the total code:

Public Class Form1

    Private Sub NameBindingNavigatorSaveItem_Click(ByVal
sender As
System.Object, ByVal e As System.EventArgs) Handles
NameBindingNavigatorSaveItem.Click
        Try
            Me.Validate()
            Me.NameBindingSource.EndEdit()
           
Me.NameTableAdapter.Update(Me.TestDatabaseDataSet.name)
            MsgBox("Saved successfully")
        Catch ex As Exception
            MsgBox("Problem saving")
        End Try

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As
System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the
'TestDatabaseDataSet.name' table. You can move, or remove
it, as needed.
       
Me.NameTableAdapter.Fill(Me.TestDatabaseDataSet.name)

    End Sub
End Class

When I run the project, I can enter data in the fields, I
click the save
button and get the msg that the save is successful. 
However, if I close
the application and the restart it, the data is not
displayed. I checked
using the "show table data" menu when I right
click the table in the
server explorer window and it also shows no data.

Can someone point out what I am not doing correctly?

Thanks,

Michael K.

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Save data to database
user name
2006-09-06 00:46:17
Sorry,

Tried that - but no difference 


Michael King
> 

-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of Booth,
Bill
Sent: Wednesday, 6 September 2006 10:10 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Save data to database

That is why I placed the square brackets around the word
name. Take
another look.

-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of King,
Michael A
Sent: Tuesday, September 05, 2006 7:00 PM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Save data to database


Bill,
Thanks for the suggestion, but that is what I am doing.  I
have confused
it a bit with my table name which is actually
"name". Cheers, 


Michael King
> 
>*Phone: 08 8282 4440
>

-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of Booth,
Bill
Sent: Wednesday, 6 September 2006 1:53 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Save data to database

This is nothing more than a guess, try something like this.

Me.NameTableAdapter.Update(Me.TestDatabaseDataSet.[name])

-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of King,
Michael A
Sent: Sunday, September 03, 2006 19:28
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: [VBDOTNET] Save data to database


Hello,

Please forgive me if this is a really obvious question.

I am just starting to explore Visual Studio 2005 and am
having a problem
saving records to a database. I have created a very simple
project using
1 form and I set up a database using the create new
datasource wizard. I
created 1 table (by right clicking on the tables folder in
the server
explorer window)

I then simply dragged the table from the Data Sources window
onto my
form where it created a grid for me along with a navigator,
table
adaptor, etc.

Here is the total code:

Public Class Form1

    Private Sub NameBindingNavigatorSaveItem_Click(ByVal
sender As
System.Object, ByVal e As System.EventArgs) Handles
NameBindingNavigatorSaveItem.Click
        Try
            Me.Validate()
            Me.NameBindingSource.EndEdit()
           
Me.NameTableAdapter.Update(Me.TestDatabaseDataSet.name)
            MsgBox("Saved successfully")
        Catch ex As Exception
            MsgBox("Problem saving")
        End Try

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As
System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the
'TestDatabaseDataSet.name' table. You can move, or remove
it, as needed.
       
Me.NameTableAdapter.Fill(Me.TestDatabaseDataSet.name)

    End Sub
End Class

When I run the project, I can enter data in the fields, I
click the save
button and get the msg that the save is successful. 
However, if I close
the application and the restart it, the data is not
displayed. I checked
using the "show table data" menu when I right
click the table in the
server explorer window and it also shows no data.

Can someone point out what I am not doing correctly?

Thanks,

Michael K.

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )