What i must use to create this form?

M

marek zegarek

Hello!

I have strange and simple problem....
I am starting developer. I need to create webform, that will insert my data
into SQL 2005 database.
My idea is to make something like MS Access Form-Subform. I'm typing data,
pressing "Add" and i see it on datagrid below. So I can type second datas,
press "Add" and now i will see two records below.

I'm using .NET (2.0), SQL 2005.

My form have two regions on one page:
- I - few texboxes, two dropdownlists (here are records from specific
tables), one button "Add"
- II - (here I need something like datalist), one button "Send to SQL"

How should look that engine?
I have ready:
- region I with textboxes and SQLcommand, that is inserting records now
into SQL database
- dataset with datatables and relations between

How to insert data into dataset and then insert it into datalist?
What I must use?

Thanks
Leszek
 
J

Jon Paal

on the post back use an sqlcommand to insert the data and another sqlcommqnd to requery the table to get the records desired and
bind to the gridview
 
M

marek zegarek

As I sad, I have form with few controls to type data.
When I push button "Add", i want to add it to datalist. Not to the database.
Then i need to add second, and third, and etc row with new data into this
datalist.
Then on finish will be button "Save" (for example), that will save all into
database.

How to add something to this datalist wiithout using sqlconnection?
 
M

Milsnips

Hi there,

how about something like this:

1. Create and populate a dataset object and bind it to the datalist control/
2. When the user clicks ADD, read the new record values that were entered,
and add a new DataRow to the dataset, then rebind the dataset again to the
datalist control.

3. When user clicks save, loop through the items in the dataset, and insert
them all into the database.

regards,
Paul
 
M

marek zegarek

I made it 2 hours ago :)
I didn't knew, how to do this, but now everything is ok :)

I will use your 2) to rebind.

Thanks Milsnips!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top