Kasuni Abegunawardana

Kasuni Abegunawardana

  • NA
  • 211
  • 121.6k

How to add a message box into a class in asp.net web forms

Nov 21 2017 9:26 AM
 
 
 I have created a class and when i'm going to add a message box it show me errors on "Response". How can  fix it.
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.UI;
namespace Food_Calorie_Calculator__Final_Project.Consultant
{
public class ConsultantRegistraion
{
public void Con_Reg()
{
string strcon = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
SqlConnection con = new SqlConnection(strcon);
try
{
con.Open();
SqlCommand cmd = new SqlCommand("insert into AdminConsultantConfirmation_tb() values()", con);
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
cmd.Parameters.AddWithValue("@", );
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.ExecuteNonQuery();
Response.write("Data is not inserted");
}
catch (Exception ex)
{
Response.write("Data is not inserted");
con.Close();
}
finally
{
}
}
}
}
 

Answers (1)