1 Replies - 7985 Views - Last Post: 08 January 2008 - 11:34 AM Rate Topic: -----

#1 dmxxmd   User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 30
  • Joined: 26-October 07

Data into database using checkboxes

Posted 07 January 2008 - 05:00 AM

Hi there

I was wondering if someone can maybe help me

Im creating a web application called spaudit, and i was wondering how to save checkboxes'es text into database..

I got a form where I can add an Auditor from a specific listbox that gets all the auditors from a specific table in the database..
Then I got a listbox underneath it where I have to select a Service provider which I also get from another table in the database..

And then I have a calender where I select a audit date, and time.

Now when I click save, all the data saves into their tables and its working just the way I want it to work.. But now I inserted checkboxes with like 10 different companies, and I created another table in the database which has 2 colomns 1. int_ServiceProviderId and 2.nv_Company.

I want the program to work like this,

I select an Auditor, a service provider, a date and time then
I need to click on a few companies that the specific service provider that I have chosen from the dropdownlistbox that the service provider supports...

Just say I want 2 from the 10 checkboxes..

Now I want the program to save the checkboxes(Companies) that is checked into the tblCompanies table... It must save the ServiceproviderId and Company..

What will the stored procedure and the physical code look like..this is how the other looks like
protected void btnSave_Click(object sender, EventArgs e)
		audit = new Audits();
		Companies = new ServiceProviderCompanies();
		SQLDAL sqlData = new SQLDAL();
		User user = (User)Session["User"];

			if (Request.QueryString["id"] != null)
				audit.ScheduleId = int.Parse(Request.QueryString["id"].ToString());

				audit.ScheduleId = 0;

			audit.ServiceProviderId = int.Parse(listServiceProvider.SelectedValue.ToString());
			audit.AuditorId = int.Parse(listAuditor.SelectedValue.ToString()); 
			audit.AuditDate = tbAuditDate.Text;
			audit.AuditTime = time2.Value.ToString();
			audit.InsertUser = user.UserName.ToString();


			if (sqlData.ErrorNumber > 0)


		sqlData = null;


Please help me with it anyone...
I will appreciate it:)

Is This A Good Question/Topic? 0
  • +

Replies To: Data into database using checkboxes

#2 tody4me   User is offline

  • Banned
  • member icon

Reputation: 13
  • View blog
  • Posts: 1,398
  • Joined: 12-April 06

Re: Data into database using checkboxes

Posted 08 January 2008 - 11:34 AM

how would storing the text from a check box value be any different than storing the data from the text box value? It's the same process as far as the storage to the database. The way that you get the data is different, as you have coded above, but the storage is the same.

This post has been edited by tody4me: 08 January 2008 - 11:35 AM

Was This Post Helpful? 1

Page 1 of 1