Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Custom Opt In C# - Uses Stored Procedure
Last Post 07-26-2011 11:41 PM by Alavri. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
AlavriUser is Offline
going with the flow
going with the flow
Posts:40
Avatar

--
01-15-2011 03:27 PM
    I Though this might be useful to some people. This is C# code that uses the Opt-In stored procedure to add a new person to a newsletter List.

    I used this on a site where people were subscribed to a newsletter when they signed up for a contest. The contest form was custom, but this piece fo code enabled me to add their name and email directly to the Opt-In newsletter (with their permission of course!)

    Thought this might be helpful:
    (note the name of the newsletter category must be exact)

    -----------------------------------------------------------------------------------------

    System.Data.SqlClient.SqlCommand cmd;
     System.Data.SqlClient.SqlConnection conn;
     conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("NAMEOFCONNECTIONSTRING"));
     
    cmd = new SqlCommand("DataSprings_OptInEmail_Add", conn);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = FIRSTNAME;
     cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value = LASTNAME;
     cmd.Parameters.Add("@EmailAddress", SqlDbType.VarChar).Value = EMAIL;
     cmd.Parameters.Add("@CategoryName", SqlDbType.VarChar).Value = "The Name of the Newsletter Category";
     cmd.Parameters.Add("@PortalID", SqlDbType.VarChar).Value = 0;

    conn.Open();
     int rows = cmd.ExecuteNonQuery();
     conn.Close();
    ----------------------------------------------------------------------------------------

    James
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    01-18-2011 01:13 PM
    Hello Alavri,

    Thank you for your contributed knowledge. I believe that many people will find this useful.

    If you ever have any questions please let me know.

    Thanks,

    Ryan
    AlavriUser is Offline
    going with the flow
    going with the flow
    Posts:40
    Avatar

    --
    07-26-2011 11:41 PM

    I Have an update to my original post. Opt In Newsletter has changed the way they insert email addresses. You not need to use two Stored procedures and also create a GUID for the email address. In addition the Category is stored as a GUID so you will need to find out what it is for the category you want to add the email to ( it is stored in the OptInCategory Table).

    Hope this helps someone else who needs to do this (create a custom opt in form)

    James



    System.Guid guid = System.Guid.NewGuid ();
    String id = guid.ToString();

    System.Data.SqlClient.SqlCommand cmd3;
    System.Data.SqlClient.SqlCommand cmd2;
    System.Data.SqlClient.SqlConnection conn3;
    conn3 = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.AppSettings.Get("SiteSqlServer"));
    cmd3 = new SqlCommand("OptInEmail_AddOptInEmail", conn3);


    cmd3.CommandType = CommandType.StoredProcedure;
    cmd3.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = txtFirstNameST2;
    cmd3.Parameters.Add("@LastName", SqlDbType.VarChar).Value = txtLastNameST2;
    cmd3.Parameters.Add("@EmailAddress", SqlDbType.VarChar).Value = EmailST2;
    cmd3.Parameters.Add("@PortalID", SqlDbType.VarChar).Value = 0;
    cmd3.Parameters.Add("@OptInEmailID", SqlDbType.VarChar).Value =id;
    cmd3.Parameters.Add("@IsVerified", SqlDbType.VarChar).Value = -1;
    cmd3.Parameters.Add("@EmailFormat", SqlDbType.VarChar).Value = 0;

    try{
    conn3.Open();
    int rows = cmd3.ExecuteNonQuery();
    conn3.Close();
    }
    catch{}

    cmd2 = new SqlCommand("OptInEmail_AddOptInCategoryEmail", conn3);
    cmd2.CommandType = CommandType.StoredProcedure;
    //Need GUID of newsletter category
    cmd2.Parameters.Add("@guidOptInCatID", SqlDbType.VarChar).Value = "f22aa8a8-ff71-4630-a3ba-9b557965cf9c";
    cmd2.Parameters.Add("@OptIn", SqlDbType.VarChar).Value = -1;
    cmd2.Parameters.Add("@guidOptInID", SqlDbType.VarChar).Value = id;

    try{
    conn3.Open();
    int rows2 = cmd2.ExecuteNonQuery();
    conn3.Close();
    }
    catch{}
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi