selvi subramanian

selvi subramanian

  • NA
  • 799
  • 572.9k

i hav error in this store procedure

Sep 1 2012 2:05 AM
store procedure




ALTER procedure [dbo].[vin]
(@namee varchar(10),@age int,@gender varchar(20))
as
begin
insert into karthi values (@namee,@age,@gender)
select * from karthi
end






coding




using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class streprocedure : System.Web.UI.Page
{
    Class1 cds = new Class1();
    string ae = "";
    string gender = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        age();
        
    }

    private void age()
    {
        ListItem li = new ListItem();
        li.Text = "Select";
        li.Value = "0";
        DropDownList1.Items.Add(li.ToString());
        for (int i = 0; i <= 100; i++)
        {
            DropDownList1.Items.Add(Convert.ToString(i));
        }
    
    
    }

    private void fem()
    {
        if (RadioButton1.Checked)
        {
            gender = "Male";
        }
        else
        {
            gender = "Female";
        }
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        age();
        fem();
        string qry = "exec vin '" + TextBox1.Text;
        qry += "','" + DropDownList1.SelectedItem.ToString();
        qry += "','" + gender;
        qry += "'";
        cds.insert(qry);
        Label4.Text = "Sucess";


    }
}





it throw the error

System.Data.SqlClient.SqlException: Invalid object name 'karthi'.








Answers (3)