473,399 Members | 4,192 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,399 software developers and data experts.

insert textBox values into database

parshupooja
159 100+
Hello

I am trying to create to a Timesheet . I am intiating number of textboxes and label based on criteria chosen by admin. This is what i have written in pageload to generate timesheet for 2 weeks
Expand|Select|Wrap|Line Numbers
  1. for (int i = 1; i <= 14; i++)
  2.         {
  3.             Label date = new Label();
  4.             date.ID = "Item" + i.ToString();
  5.             date.Text = DateTime.Now.AddDays(i).ToShortDateString();
  6.             Label day = new Label();
  7.             day.ID = "day" + i.ToString();
  8.             day.Text = DateTime.Parse(date.Text).DayOfWeek.ToString();
  9.             day.Text = day.Text.Substring(0, 3);
  10.             TextBox txtmin = new TextBox();
  11.             txtmin.ID = "txtmin" + i.ToString();
  12.             TextBox txtmout = new TextBox();
  13.             TextBox txtain = new TextBox();
  14.             TextBox txtaout = new TextBox();
  15.             AreaDay.Controls.Add(day);
  16.             AreaDay.Controls.Add(new LiteralControl("<br><br><br>"));
  17.             AreaDate.Controls.Add(date);
  18.             AreaDate.Controls.Add(new LiteralControl("<br><br><br>"));
  19.             AreaMIn.Controls.Add(txtmin);
  20.             AreaMIn.Controls.Add(new LiteralControl(" <br> "));
  21.             AreaMOut.Controls.Add(txtmout);
  22.             AreaMOut.Controls.Add(new LiteralControl(" <br>  "));
  23.             AreaAIn.Controls.Add(txtain);
  24.             AreaAIn.Controls.Add(new LiteralControl("  <br> "));
  25.             AreaAOut.Controls.Add(txtaout);
  26.             AreaAOut.Controls.Add(new LiteralControl("  <br> "));
  27.         }
everything starts with Area is placeholders on page which I am using to to add controls

now on the click event of button i want to execute store procedure which passes these textboxes and label values to database.
Sep 6 '07 #1
5 2752
KBTibbs
13
Hello

I am trying to create to a Timesheet . I am intiating number of textboxes and label based on criteria chosen by admin. This is what i have written in pageload to generate timesheet for 2 weeks
...
everything starts with Area is placeholders on page which I am using to to add controls

now on the click event of button i want to execute store procedure which passes these textboxes and label values to database.
Are you asking how to get the information entered in the text boxes into a database? If so, it can depend on what developing environment you are using and what database you choose to use. What environment/compiler are you using and what type of database?
Sep 6 '07 #2
Add all the controls created to a panel. Later loop through the control collection of panel and based on the id(i value) , insert the entries into the database.
Sep 6 '07 #3
parshupooja
159 100+
@KBTibbs

Sorry forgot to mention I am using Asp.Net C#

Are you asking how to get the information entered in the text boxes into a database? If so, it can depend on what developing environment you are using and what database you choose to use. What environment/compiler are you using and what type of database?
Sep 7 '07 #4
parshupooja
159 100+
@csoftee

You are right I thought of it but don't know how to achieve that. I am newbie . If u could show me snippet or lead me to example or article, that will be great help.

Thank You

Add all the controls created to a panel. Later loop through the control collection of panel and based on the id(i value) , insert the entries into the database.
Sep 7 '07 #5
@csoftee

You are right I thought of it but don't know how to achieve that. I am newbie . If u could show me snippet or lead me to example or article, that will be great help.

Thank You
Looping can be done, but for creating timesheet these many controls are not needed, since passing on these many values to database constitutes redundant code. Try to create the timesheet in gridview which allows editing the entries. Sending the gridview data to database is easy as it will be bound to a datasource(ex:datatable, dataset). Check an example of a gridview and implement this.
Sep 7 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Abareblue | last post by:
I have no clue on how to insert a record into access. here is the whole thing using System; using System.Drawing; using System.Collections; using System.ComponentModel;
10
by: Ricardo | last post by:
How can I make a insert sql string to insert direct in a table(not a dataset) using the textbox.text propert??
11
by: anony | last post by:
Hello, I can't figure out why my parameterized query from an ASP.NET page is dropping "special" characters such as accented quotes & apostrophes, the registered trademark symbol, etc. These...
3
by: | last post by:
I'm picking up an 'IMPORTS' error for a simple database insert based on two input entry boxes in my form? It says an 'Imports' statement must preceede any declarations....... is this perahps the...
7
by: | last post by:
I am having trouble figuring out to call a database INSERT procedure from a simple submit form. It appears I should use the onclick event to trigger the procedure called BUT when I do this I...
1
by: Primillo | last post by:
'Full source 'Insert, delete and update don't work Public Class WebForm1 Inherits System.Web.UI.Page Protected WithEvents Button1 As System.Web.UI.WebControls.Button Protected WithEvents...
2
by: Polyhedron_12 | last post by:
I am having problems calling functions in general in VB. I keep getting alot of errors. Can anybody help me out with this? I put the error message on the same line that it says it is at. I believe...
1
by: Ed Dror | last post by:
Hi there, I have ASP <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Guestbook.aspx.vb" Inherits="Guestbook" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
0
by: Bo | last post by:
Can anyone explain why the code below inserts blank values into my access database while the same code without the masterpagefile reference works and inserts the values? <%@ Page Language="VB"...
2
by: blitzztriger | last post by:
Hello!! how do i insert values into mysql , after parsing a submiting textbox?? I made the arrays, so this should be a basic insertion of them in the db, but something is missing, or in the wrong...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.