Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there an easier way to create a form for editing a database table?

Status
Not open for further replies.

UGrad

Programmer
Oct 15, 2002
40
0
0
CA
Hi,
I have a SQL database table with around 100 fields.
I created a search page for user to search the table. Then another page to display the search result. User can click on each record and go to another page to do the editing.
My question is for the editing page, I have to manually create 100 fields (textbox, checkbox, dropdown, or radio button) and SQL query string for updating the database. It's very time consuming. Is there an easier way to create this page. Is it possible to drag-and-drop a table from the server explorer to the form and it will create all the fields automatically?
 
Try using a datagrid. I have to say, having the user edit 100 fields is a bit much.

Jim
 
Yeah. 100 fields is a bit much.
I use the table to store contact info. For exmaple: first name, last name, business phone #, home phone #, and .... Not all fields are required.
 
I would also use a dg.

as jbenson001 said, 100 fields is alot.

You may want to re-think your table structure.

 
I would limit it to what the user would want to see, like if you had a page that showed a list of contacts. If all fields aren't required, don't show them. You can always insert default values for the other columns if you want.
 
ive never got around to something that cool
had to type out each box, and the select and update statement got huge, but it was only 20 or so boxes!

even in a datagrid, you'll have a lot of typing to do, and testing to make sure your data is correct!

but datagrid or datalist is your best option because you can databind the values instead of typing in txtbox=data.tables(0).rows(0).item("item") for each of your textboxes in code

you can do
<asp:TextBox id=txtDate text='<%# DataBinder.Eval(Container.DataItem, "date" ,"{0:d}") %>' /> and so on

then your code is just
DataGrid.Datasource = ds
DataGrid.DataBind()

the way to do one row datagrids is to do a SELECT * FROM table WHERE uniqueID = uniqueVar (only one row returns)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top