Groups | Blog | Home
all groups > vb.net data > september 2006 >

vb.net data : Saving modification


Nagesh S K
9/28/2006 12:00:00 AM
Hi All

I am new to VB and .Net. Have done some basic c programing about 10
years ago. I have downloaded Vb 2005 Express edition and trying to
learn it on my own. I have VB 2005 express for Dummies book and have
followed the examples given there.

I have built a programe which uses a single database with one table in
it. I have magaded to populate datagridview with data from table, can
add a new row and save it, have added a query which fetches records
based on user keyword and displayes it on a seperate form. However i
am not able to save any changes done to already existing data on
table. This has stumped me.

Can any body post some codes on how to do this or point me to some
likns with useful information.


Regards

SKN
William (Bill) Vaughn
9/28/2006 10:53:06 AM
I suggest you sign up for the "EarlyBird" discount on my new book that was
written specifically for developers like you. It's rich with walkthroughs
and examples that will save you a lot of time and frustration. See the links
below...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
_________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)


INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

[quoted text, click to view]

William (Bill) Vaughn
9/28/2006 2:00:47 PM
Ah, so you think we provide help on these public newsgroups just to plug our
books? I have been posting to this site and sites like it for about 15
years. Sahil, David Scheppa and all have books we would like subscribers to
this newsgroup to read. But we can't expect much in return. I have just
spent over two years writing my 12th book. I expect to make as much as you
pay for fries at McDonalds on each copy. I write books to provide a way to
pass on what I've learned to others--it's certainly not for the money. Any
technical book author will tell you that. These books (mine and others)
often have the complete answers to questions asked here in years past--not
just a 20-line block of code that might solve an immediate problem.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
Between now and Nov. 6th 2006 you can sign up for a substantial discount.
Look for the "Early Bird" discount checkbox on the registration form...


[quoted text, click to view]

Miro
9/28/2006 4:40:52 PM
Can you post some code...I'm a newbie, but I have 3 books I have purchased
and might be able to find an example to copy out and give to you. Ive just
started into mdb's but I have successfuly "Added", "deleted", and "changed"
records.

I would also recommend posting to microsoft.public.dotnet.languages.vb
you wont get everyone trying to plug you their book comin out.

But I will try to help you.

Is it an access mdb file?

Miro

[quoted text, click to view]

Miro
9/28/2006 8:51:56 PM
Yes I agree ( in the fries comment ),

But by your answer given, instead of giving an answer, you try to sell a
book.
Which is fine, business is business. But it defeats the purpose of an
Internet Newsgroup.

Imagine what the internet would become, if the information that is freely
available by peoples thoughts and opinions would cost you money ( excluding
the cost of hooking up to the internet ).

I view a newsgroup as "You get help, you try to give help." As you go up
the ladder of knowledge, you can help the people below the ladder. We are
all here for the greater good.

Thats just my opinion.

M.
-This message will cost you a nickle. ;-)


[quoted text, click to view]

Nagesh S K
9/29/2006 12:00:00 AM
On Thu, 28 Sep 2006 20:51:56 -0400, "Miro" <mironagy@golden.net>
[quoted text, click to view]


Hi all

Thanks for the responses

Actually I dont mind buying a book or two if it going to help me in my
further learning.

now this program i am trying to write is based on the same example
that is given along with VB 2005 express help tutorials. I have done
every thing same that is using SQL express database, added the data
grid to display data on a form, added the code given there to "Save"
Button. Omly changes i have made is to substitute actual dataset,
table and adapter names.


Private Sub MaintdataBindingNavigatorSaveItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
MaintdataBindingNavigatorSaveItem.Click
If Me.Validate() Then
Me.MaintdataBindingSource.EndEdit()
Me.MaintdataTableAdapter.Update(Me.Database1DataSet1.maintdata)
MsgBox("SAVED DATA")

Else
System.Windows.Forms.MessageBox.Show(Me, _
"Validation errors occurred.", "Save", _
System.Windows.Forms.MessageBoxButtons.OK, _
System.Windows.Forms.MessageBoxIcon.Warning)
End If
End Sub

This saves a new record added, but when i modify existing record it
gives an exception.

Regards

SKN
William (Bill) Vaughn
9/29/2006 1:44:05 PM
What does the record look like? How are you managing the PK? Are you
changing the PK and try to update? Does the generated code deal correctly
with post-insert PK passback? What exception are you getting?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
Between now and Nov. 6th 2006 you can sign up for a substantial discount.
Look for the "Early Bird" discount checkbox on the registration form...

[quoted text, click to view]

AddThis Social Bookmark Button