hi
can any body give me insert stored procedure coding for this
insert class
public int InsertCountries()
{
try
{
SqlParameter[] p = new SqlParameter[10];
p[0] = new SqlParameter("@CountryName", Name);
p[1] = new SqlParameter("@CountryAbbr", Abbreviation);
p[2] = new SqlParameter("@CountryDesc", Description);
p[3] = new SqlParameter("@CountryMap", Map);
p[4] = new SqlParameter("@CountryMapFile", MapFile);
p[5] = new SqlParameter("@CountryFlag", Flag);
p[6] = new SqlParameter("@CountryFlagFile", FlagFile);
p[7] = new SqlParameter("@CountryVideo", Video);
p[8] = new SqlParameter("@CountryVideoFile", VideoFile);
p[9] = new SqlParameter("@Flag", SqlDbType.Int);
p[9].Direction = ParameterDirection.Output;
SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure, "spInsertCountries", p);
return Convert.ToInt32(p[9].Value);
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
}
aspx page
protected void BtnAdd_Click(object sender, EventArgs e)
{
try
{
objVisaType.Name = txtCountryName.Text.Trim();
objVisaType.Abbreviation = txtCountryAbbr.Text.Trim();
objVisaType.Description = txtCountryDesc.Text.Trim();
objVisaType.Map = (byte[])Session["Photo"];
objVisaType.MapFile = Session["FileName"].ToString();
objVisaType.Flag = (byte[])Session["FlagPhoto"];
objVisaType.FlagFile = Session["FlagFileName"].ToString();
objVisaType.Video = (byte[])Session["VideoFileContent"];
objVisaType.VideoFile = Session["VideoFileName"].ToString();
int Flag = objVisaType.InsertCountries();
if (Flag == 1)
{
Page.RegisterClientScriptBlock("Travel", "<script>alert('Country Inserted')</script>");
btnClear_Click(sender, e);
}
else if (Flag == 0)
{
Page.RegisterClientScriptBlock("Travel", "<script>alert('Bad Server Request, Try again')</script>");
btnClear_Click(sender, e);
}
else if (Flag == 2)
{
Page.RegisterClientScriptBlock("Travel", "<script>alert(Country Already Inserted')</script>");
}
}
catch (Exception ex)
{
lblMsg.Text = ex.Message;
}
}
sankarreddy