| | |
add data into a sql with a drop down
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2009
Posts: 8
Reputation:
Solved Threads: 0
hi
this may sound simple but i can not get it to work i have try for about 5-6 weeks now and this my last hope
all my project is to make a job dater base that workers can add jobs and cliences can see there job but i am stuck on
the user (user being the worker) fill out a form(this would be a new job) and then sumit it to a dater base.
the form will include
job name = text box
job status = drop down box
hazarads = drop down box
design staff = drop down box
description = multiline text box
and a few more but if i know how to do them then i can figure out how do the others.
any help please
thanks alot
ANY questions please please ask
using asp.net would perfure vb but that desprate will use c#
this may sound simple but i can not get it to work i have try for about 5-6 weeks now and this my last hope
all my project is to make a job dater base that workers can add jobs and cliences can see there job but i am stuck on
the user (user being the worker) fill out a form(this would be a new job) and then sumit it to a dater base.
the form will include
job name = text box
job status = drop down box
hazarads = drop down box
design staff = drop down box
description = multiline text box
and a few more but if i know how to do them then i can figure out how do the others.
any help please
thanks alot
ANY questions please please ask
using asp.net would perfure vb but that desprate will use c#
Last edited by motters; Aug 23rd, 2009 at 12:17 pm. Reason: add detail
•
•
Join Date: Aug 2009
Posts: 8
Reputation:
Solved Threads: 0
Last edited by peter_budo; Aug 23rd, 2009 at 4:13 pm. Reason: Snipping email from quote
•
•
Join Date: Mar 2008
Posts: 324
Reputation:
Solved Threads: 7
ks so simple it is..I m showing u the code dat add data to SQL database but from textbox,U just change dropdown here..
ASP.NET Syntax (Toggle Plain Text)
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class FrmRegistration : System.Web.UI.Page { SqlConnection conn = new SqlConnection("Data Source=SONIA-B408A4159\\SQLEXPRESS;Initial catalog=sonia;Integrated Security=true"); string query; SqlCommand cmd; protected void btnSubmit_Click(object sender, EventArgs e) { query = "Insert into UserInfo values(@name,@email)"; cmd = new SqlCommand(query, conn); conn.Open(); cmd.Parameters.AddWithValue("@name", txtName.Text); cmd.Parameters.AddWithValue("@email", txtEmail.Text); cmd.ExecuteNonQuery(); conn.Close(); } }
ASP.NET Syntax (Toggle Plain Text)
create table UserInfo(Name varchar(100),EMail varchar(100)) select * from UserInfo delete from UserInfo
Last edited by sonia sardana; Aug 23rd, 2009 at 1:26 pm.
•
•
Join Date: Aug 2009
Posts: 8
Reputation:
Solved Threads: 0
•
•
•
•
motters: Please post your project. Zip it and upload the entire project.
--------------------------------------------------------------------------------
also i have i problem with the code supply
c# Syntax (Toggle Plain Text)
protected void btnSubmit_Click(object sender, EventArgs e) { query = "Insert into UserInfo values(@name,@email)"; cmd = new SqlCommand(query, conn); conn.Open(); cmd.Parameters.AddWithValue("@name",[B] txtName[/B].Text); cmd.Parameters.AddWithValue("@email", [B]txtEmai[/B]l.Text); cmd.ExecuteNonQuery(); conn.Close(); }
where is says txtName and txtEmail i have a red line uder and it says "txtName does not exsist in the current context"
same for txtEmail.
on my page i do have two text boxs one called
txtName and the other one
txtEmail
what have i done wrong
thanks alot for your help
Last edited by peter_budo; Aug 23rd, 2009 at 4:14 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Please use code tags when posting code on daniweb:
[code=csharp]
...code here...
[/code]
It sounds like you're creating the controls dynamically. It is impossible to tell what is really going on without an uploaded sample project. You can create a new project and move over enough code to reproduce the issue.
[code=csharp]
...code here...
[/code]
It sounds like you're creating the controls dynamically. It is impossible to tell what is really going on without an uploaded sample project. You can create a new project and move over enough code to reproduce the issue.
![]() |
Similar Threads
- Do anyone know the example code for VB6 on add and update data to the ms sql 2000 (Visual Basic 4 / 5 / 6)
- Sql command to add new data using store values? (C#)
- How to import Excel Sheet data into SQL Server 2003 ???? Stpes. (MS SQL)
- Command object use to add data to a database (MySQL)
- ootball league table - add data (C)
- VB - How to open an Excel Doc w/ existing data & add data in specific cells? (VB.NET)
- Convert XML data to sql table through coding in ASP.Net2.0 (IT Professionals' Lounge)
- Unable to insert data into SQL Database (ASP)
- how to add data (ASP)
Other Threads in the ASP.NET Forum
- Previous Thread: DataReader Vs DataSet
- Next Thread: how to dynamically set the text of a label using the text from textbox?
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax appliances application asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox child class compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datalist deadlock deployment development dgv dialog dropdownmenu dynamic dynamically edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv form forms grid gridview gudi homeedition hosting iis image javascript jquery list menu mssql multistepregistration nameisnotdeclared novell objects opera order problem ratings redirect registration relationaldatabases rotatepage search security select serializesmo.table sessionvariables silverlight smoobjects sql ssl tracking treeview typeof validatedate validation vb.net virtualdirectory vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment wizard xml xsl






