Click here to Skip to main content
11,489,693 members (64,360 online)
Rate this: bad
good
Please Sign up or sign in to vote.
Hello friends,

I have used stored procedure to insert values in two tables

1.register
2.login


It is displaying errors...
Msg 207, Level 16, State 1, Procedure str_insert_register, Line 22
Invalid column name 'adtsite'.
Msg 207, Level 16, State 1, Procedure str_insert_register, Line 24
Invalid column name 'emailid'.

The Code Is:
CREATE PROCEDURE str_insert_register 
@username nvarchar(50),
@firstname nvarchar(50),
@lastname nvarchar(50),
@fullname nvarchar(50),
@city nvarchar(50),
@street nvarchar(50),
@postcode nvarchar(50),
@telephone nvarchar(50), 
@dob nvarchar(50),
@occupation nvarchar(50),
@emailid nvarchar(50),
@pwd nvarchar(50),
@abtsite nvarchar(50),
@entrydate datetime,
@activestatus int
AS
BEGIN
SET NOCOUNT ON 
declare @id as int
SET @username=@firstname+right('0'+convert(varchar,datepart(dd,getdate())) ,2)
insert into register(id,username,firstname,lastname,fullname,city,street,postcode,telephone,dob,occupation,emailid,pwd,adtsite,entrydate,activestatus)values(@id,@username,@firstname,@lastname,@fullname,@city,@street,@postcode,@telephone,@dob,@occupation,@emailid,@pwd,@abtsite,@entrydate,@activestatus)
declare @stid as int
insert into login(stid,username,emailid,pwd)values(@stid,@username,@emailid,@pwd)
END 
GO

Please check.
How can I resolve this error ?
Posted 26-Feb-13 22:02pm
v2
Comments
willington.d at 27-Feb-13 3:18am
   
Check whether those columns are there in that Table...

send me the Table structure of register table....

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

As the error suggest there is no column named "adtsite" and in "emailid" in your "register" table
  Permalink  
Comments
Tadit Dash at 27-Feb-13 3:58am
   
[Comments By OP]

Thanks...I got IT, really thankxxx!!
Ankit_Sharma1987 at 27-Feb-13 7:55am
   
Hello,
i have used this code , to execute this stored proceedure...But it is giving an exeption,
please help...

protected void btn_submit_Click(object sender, EventArgs e)
{
try
{
cnn.ConnectionString = ConfigurationManager.ConnectionStrings["jin"].ConnectionString;
SqlCommand cm = new SqlCommand("register",cnn);
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "str_insert_register";
cm.Parameters.Add("title",SqlDbType.NVarChar,50).Value = ddl_title.SelectedItem.ToString();
cm.Parameters.Add("firstname", SqlDbType.NVarChar, 50).Value=txt_fname.Text;
cm.Parameters.Add("lastname", SqlDbType.NVarChar, 50).Value=txt_lname.Text;
cm.Parameters.Add("fullname", SqlDbType.NVarChar, 50).Value=txt_fname.Text +" "+txt_lname.Text;
cm.Parameters.Add("city", SqlDbType.NVarChar, 50).Value=txt_city.Text;
cm.Parameters.Add("street", SqlDbType.NVarChar, 50).Value=txt_street.Text;
cm.Parameters.Add("postcode", SqlDbType.NVarChar, 50).Value=txt_postcode.Text;
cm.Parameters.Add("telephone", SqlDbType.NVarChar, 50).Value=txt_telephone.Text;
cm.Parameters.Add("dob", SqlDbType.NVarChar, 50).Value=txt_dob.Text;
cm.Parameters.Add("occupation", SqlDbType.NVarChar, 50).Value=ddl_occup.SelectedItem.ToString();
cm.Parameters.Add("emailid", SqlDbType.NVarChar, 50).Value = txt_email.Text;
cm.Parameters.Add("pwd",SqlDbType.NVarChar,50).Value=txt_pwd.Text;
cm.Parameters.Add("abtsite", SqlDbType.NVarChar, 50).Value = ddl_abtsite.SelectedItem.ToString();
SqlDataReader dr;
cnn.Open();
dr = cm.ExecuteReader();
cnn.Close();

lbl_msg.Text = "Registration is Done Successfully!!";
}
catch(Exception ex)
{
lbl_msg.Text = "There is some Error!!";
}
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 595
1 Andy Lanng 233
2 OriginalGriff 213
3 Maciej Los 170
4 _duDE_ 141
0 Sergey Alexandrovich Kryukov 9,608
1 OriginalGriff 8,475
2 Sascha Lefèvre 3,419
3 Maciej Los 3,106
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100