473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Adding New Record - SQL Expres DB

vb.net 2005 express

I havnt posted in a while but I have been busy doing the tutorials on the
SQL Express and the first VB.net videos.
( Basically started from scratch and gave up the idea of mdb tables and
moving to SQL Express ).

One thing I cant seem to find / figure out is this.

I have dragged a table onto my form which in term binded everything for me
and also put a navigator.
Lets say this table has
ID ( unique key ) - Auto Increment
Name varchar(20) - not nullable
Then I added the Name field to the form as well ( so its binded as well).

As i click on teh add buttons on the binding navigator, the field i added
also updates.
If I click on the add button within the binding navigator, the field in the
datagrid jumps to the bottom with a
new 'ID' that has been autoincremented and the Name field is blank awaiting
input.

I can now either edit the field in the datagrid or the field.
Once I do this - i click save and all is well.

How do I 'code' the add button manually in a command button.
I cant seem to figure out how to look at the binding navigators code.
-so everything "blanks" on the textboxes, the navigator goes to the
bottom and ready for input.

Thanks

Miro
Jun 30 '07 #1
1 2119
I got it,

Very simple, once you can get through the help files no express

Me.BindingSourceName.AddNew()

This throws the datagrid into an add mode and at the same time clears all
your binded text boxes.

and to save,
Me.Me.BindingSourceName.AddNew.EndEdit()
Me.TableAdapterName.Update(Me.DataSetName.TableNam e)

Cheers'

Miro
"Miro" <mi******@golden.netwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
vb.net 2005 express

I havnt posted in a while but I have been busy doing the tutorials on the
SQL Express and the first VB.net videos.
( Basically started from scratch and gave up the idea of mdb tables and
moving to SQL Express ).

One thing I cant seem to find / figure out is this.

I have dragged a table onto my form which in term binded everything for me
and also put a navigator.
Lets say this table has
ID ( unique key ) - Auto Increment
Name varchar(20) - not nullable
Then I added the Name field to the form as well ( so its binded as well).

As i click on teh add buttons on the binding navigator, the field i added
also updates.
If I click on the add button within the binding navigator, the field in
the datagrid jumps to the bottom with a
new 'ID' that has been autoincremented and the Name field is blank
awaiting input.

I can now either edit the field in the datagrid or the field.
Once I do this - i click save and all is well.

How do I 'code' the add button manually in a command button.
I cant seem to figure out how to look at the binding navigators code.
-so everything "blanks" on the textboxes, the navigator goes to the
bottom and ready for input.

Thanks

Miro

Jul 3 '07 #2

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

Similar topics

6
by: Jamie Fryatt | last post by:
Hi everyone, here's what id like to do. I have a table with 2 fields, name and value I need to be able to add multiple records quickly, for example I need to add name value abc 1...
2
by: brenda.stow | last post by:
error msg " An error occured while referencing the object. You tried to run a visual basic procedure that improperly references a property or method of an object" This msg occurs everytime I add a...
2
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete...
3
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...
6
by: TomislaW | last post by:
Is it possible to access outlook expres mail, with dot net?
9
by: Greg | last post by:
Binding Manager & dataset - won't add record I've got an untyped dataset with controls bound through code. The user can select a question number from a bound combobox, and the question number and...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
8
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
3
by: john | last post by:
In my form (table A) I have subform (table B (only 2 fieds: ID and App_name) where table A -Table B are linked 1XM. To be able to add a record in the subform I want to use a lookup form since the...
1
by: tonylove42 | last post by:
HI, I have probelm adding, updating and deleteing a record. Here is my code for adding . The error I get is: Operation must use an updateable query. Line 135: MyCmd.ExecuteNonQuery() ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.