datagrid  + vb

bkanthavelms
bkanthavelms used Ask the Experts™
on
Hello
i need help

       * I am using msaccess vb with msaccess
and I am using datagrid


       My ques is how can I add more more one record at a time without update in database. ie.when i click save button then that the more than one record will update to database.

waiting for ur rep


Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
they why not use a temporary table. you could replicate your original table, then on save simply move all records from your temp table to your original table.

i use this most of the time.

Author

Commented:
Sir
How can i add more than one record in datagrid with vb
and ms access
waiting for ur rep

Commented:
simply add your record to your recordset. then after adding, refresh your grid by datagrid.refresh

private sub cmdAdd_click()
dim conn as ado.connection
dim rst as ado.recordset

Set conn = New ADODB.Connection

conn.Provider = "Microsoft.JET.OLEDB.4.0"
conn.ConnectionString = "<YOUR MDB FILE>"
conn.Mode = adModeReadWrite
conn.Open

set rst=new adodb.recordset
rst.open "<YOUR INSERT STATEMENT>", conn, adOpenForwardOnly
set rst=nothing
conn.close
set conn=nothing
end sub
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Respected sir
i have one datagrid and one command button whenever i click command button one row will increase.
how can i increase?
waiting for ur rep

Author

Commented:
thank u for ur rep

Commented:
just add the "datagrid1.refresh" command after your insert statement. it is important that refresh your grid to update your entries.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial