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#

hi frnd , can u plz explain ur question more clearly...or send me ur question on mine id <EMAIL SNIPPED>

commented: keep it on the forum! -2

hi frnd , can u plz explain ur question more clearly...or send me ur question on mine id <EMAIL SNIPPED>

ok thanks for helping me

all i want to do is to add data into sql dater base using a drop down box,text box, and mulitly line text box

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..

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();
      
      
    }
}
create table UserInfo(Name varchar(100),EMail varchar(100))
select * from UserInfo
delete from UserInfo

motters: Please post your project. Zip it and upload the entire project.

motters: Please post your project. Zip it and upload the entire project.

there is one problem with that i am in test stages i am testing that i can do everything needed for the project. so not starting project till i know how to slove this problem. so i have know thing to upload. :'(


--------------------------------------------------------------------------------

also i have i problem with the code supply

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 :confused:


thanks alot for your help

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.

ok sorry for not using he code tag i will from now on sorry :icon_rolleyes:


i will get together a sample project as soon as i can

thanks for all your help

just remove the txtName.Text & type it again..Dont cut & paste it again...

just remove the txtName.Text & type it again..Dont cut & paste it again...

i have just try that am it did not work should the text box be in a formview?

have u any textboxes of such names in ur design view or not???????

have u any textboxes of such names in ur design view or not???????

on my design view i have two text boxs one called txtName and the other called txtEmail

is the intellisense showing the two text boxes?

is the intellisense showing the two text boxes?

ok i have made a video to show evry one what i am doing i forgot to show you the data base but the dater base has a table called Userinfo and in Userinfo to coloums called Name and EMail

thanks for all your help


link to video

http://motters.co.cc/myproblem/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.