.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Create a "Tell a friend" form

Posted By:Deepika Haridas       Posted Date: September 28, 2009    Points: 10    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

Code for creating a simple "TELL A FRIEND" web form which you see in most of the music sites.

I am attaching the Design View of the form to get a clear picture of the form.

Partial Class _friend
Inherits System.Web.UI.Page

Dim conn As New Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Admin\My Documents\Visual Stdio 2005\Websites\mp3\App_Data\Database.mdf;Integrated Security=True;User Instance=True")

Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click
Dim param As New Data.SqlClient.SqlParameter("@song", Data.SqlDbType.NVarChar)
param.Direction = Data.ParameterDirection.Input
param.Value = song.Text
Dim param2 As New Data.SqlClient.SqlParameter("@yname", Data.SqlDbType.NVarChar)
param2.Direction = Data.ParameterDirection.Input
param2.Value = yname.Text
Dim param3 As New Data.SqlClient.SqlParameter("@yemail", Data.SqlDbType.NVarChar)
param3.Direction = Data.ParameterDirection.Input
param3.Value = yemail.Text
Dim param4 As New Data.SqlClient.SqlParameter("@fname", Data.SqlDbType.NVarChar)
param4.Direction = Data.ParameterDirection.Input
param4.Value = fname.Text
Dim param5 As New Data.SqlClient.SqlParameter("@femail", Data.SqlDbType.NVarChar)
param5.Direction = Data.ParameterDirection.Input
param5.Value = femail.Text
Dim param6 As New Data.SqlClient.SqlParameter("@message", Data.SqlDbType.NVarChar)
param6.Direction = Data.ParameterDirection.Input
param6.Value = message.Text
Dim command As New Data.SqlClient.SqlCommand("insert into tell values(@song,@yname,@yemail,@fname,@femail,@message)", conn)

End Sub
End Class


Further Readings:

Author: Venkat         Company URL: http://www.dotnetspark.com
Posted Date: September 28, 2009

Hi Deepika,

For "Tell A Friend" Usually we send mail to the concerned person...but i couldn't able to see the mail part to complete the "Tell A Friend" Feature.

Sorry if i understood your code wrong...

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend