Beispiel #1
0
 public static int InsertItem(WebMenuItem item)
 {
     using (SqlCommand textCommand = SqlHelper.GetTextCommand("INSERT MenuItems (Title, Link, System, NewWindow, Description)\r\nVALUES (@title, @link, 'N', @newwindow, @description)\r\nSELECT scope_identity()"))
     {
         textCommand.Parameters.AddWithValue("title", (object)item.get_Title());
         textCommand.Parameters.AddWithValue("link", (object)item.get_Link());
         textCommand.Parameters.AddWithValue("newwindow", item.get_NewWindow() ? (object)"Y" : (object)"N");
         textCommand.Parameters.AddWithValue("description", (object)item.get_Description());
         return(Convert.ToInt32(SqlHelper.ExecuteScalar(textCommand)));
     }
 }