Hi to all,
Sorry to bother you with what might seem beginners question, I tried to use ListView1_ItemCommand to as shown in my code below, but nothing happened the insert command is not firing should I use OnCommandInserting, if there is a form or example on how this could be done I would deeply appreciated.
thanks.
Rasha.
Sorry to bother you with what might seem beginners question, I tried to use ListView1_ItemCommand to as shown in my code below, but nothing happened the insert command is not firing should I use OnCommandInserting, if there is a form or example on how this could be done I would deeply appreciated.
thanks.
Rasha.
if
(e.CommandName == RadListView.PerformInsertCommandName)
{
SqlCommand cmd =
new
SqlCommand();
try
{
SqlConnection con = DataAccess.Connection.GetDBConnection();
if
(con.State == ConnectionState.Closed)
{
con.Open();
}
cmd.CommandText =
"INSERT INTO [Package] VALUES (@PackageName, @PackageDesc, @PricePerMonth, @discountPercent, @NumOfImg, @NumOfGIF, @NumOfFlash, @isHomePageIncluded)"
;
cmd.Parameters.Add(
"@PackageName"
, SqlDbType.VarChar);
cmd.Parameters.Add(
"@PackageDesc"
, SqlDbType.VarChar);
cmd.Parameters.Add(
"@PricePerMonth"
, SqlDbType.Money);
cmd.Parameters.Add(
"@discountPercent"
, SqlDbType.Float);
cmd.Parameters.Add(
"@NumOfImg"
, SqlDbType.Int);
cmd.Parameters.Add(
"@NumOfGIF"
, SqlDbType.Int);
cmd.Parameters.Add(
"@NumOfFlash"
, SqlDbType.Int);
cmd.Parameters.Add(
"@isHomePageIncluded"
, SqlDbType.Bit);
cmd.Connection = con;
int
result = cmd.ExecuteNonQuery();
con.Close();
}
catch
(Exception exp)
{
Response.Write(exp +
"in Command: "
+ cmd.ToString());
}