Anil Sharma

Anil Sharma

  • NA
  • 29
  • 15k

how to call scalar function sqlserver in asp.net.cs

Feb 19 2020 6:42 AM
hi expert 
please guide me how i can call the function result  in asp.net program in a text  field 
i try as below but result is null 
 
SqlCommand cmd = new SqlCommand("SELECT * FROM dbo.check_farmer_loan(@farmer_cd)", connect);
// cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@farmer_cd",party_code.Text);
SqlDataAdapter db = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
db.Fill(dt);
loan_amt.Text = dt.Rows[0][0].ToString();
 

Answers (4)