Amit Kumar

Amit Kumar

  • 1.9k
  • 140
  • 35.9k

how to insert function value in coloumn

Nov 24 2013 5:49 AM
i have created an sql function  in database name datainfo and table name as book.

create function[dbo].[book_id](@id int)
return char(12)
begin return 'bkooID'+right('00000'+convert(varchar(10),@id),5)

i want to insert this value in column book_id using on button click.. 
please write sqlcommand for this.

this is my sqlconnection code 
    SqlConnection con;
    SqlCommand cmd;
    string str = ConfigurationManager.ConnectionStrings["connect"].ConnectionString;
 protected void btnSubmit_Click(object sender, EventArgs e)
        SqlConnection con = new SqlConnection(str);


Answers (2)