Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i have a requirement i have to generate a HTML file whenever data is inserted into database from a feedback form. The Html form will serve as an instant data-display mechanism? i have done the insertion part but i don't know how to go about generating Html file of all the data filled in feedback form on insertion? kindly help


this is my insert function i have no idea about how to generate html file

VB
Public Sub feedback()

       'Dim query As DataTable = fill()

       con.Open()
       Dim cmd As New OracleCommand
       cmd.Connection = con
       Dim entr As Date
       entr = Date.Today
       cmd.CommandType = CommandType.Text
       cmd.CommandText = "insert into testerc (fileno,name,email,datesession,q1,q2,q3,q4,q5,q6,q7,q8,remarks) values(:fileno,:name,:email,:datesession,:q1,:q2,:q3,:q4,:q5,:q6,:q7,:q8,:remarks)"
       cmd.Parameters.Clear()
       cmd.Parameters.AddWithValue(":fileno", lbfile.Text)
       cmd.Parameters.AddWithValue(":name", lbname.Text)
       cmd.Parameters.AddWithValue(":email", lbemail.Text)
       cmd.Parameters.AddWithValue(":datesession", RadDatePicker1.SelectedDate)

       If RadioButton1.Checked = True Then
           cmd.Parameters.AddWithValue(":q1", "Excellent")
       ElseIf RadioButton2.Checked = True Then
           cmd.Parameters.AddWithValue(":q1", "Good")
           ElseIf RadioButton3.Checked = True Then
           cmd.Parameters.AddWithValue(":q1", "Average")
               ElseIf RadioButton4.Checked = True Then
           cmd.Parameters.AddWithValue(":q1", "Poor")
                   End If

       If RadioButton5.Checked = True Then
           cmd.Parameters.AddWithValue(":q2", "Excellent")
       ElseIf RadioButton6.Checked = True Then
           cmd.Parameters.AddWithValue(":q2", "Good")
       ElseIf RadioButton7.Checked = True Then
           cmd.Parameters.AddWithValue(":q2", "Average")
       ElseIf RadioButton8.Checked = True Then
           cmd.Parameters.AddWithValue(":q2", "Poor")
       End If

       If RadioButton9.Checked = True Then
           cmd.Parameters.AddWithValue(":q3", "Excellent")
       ElseIf RadioButton10.Checked = True Then
           cmd.Parameters.AddWithValue(":q3", "Good")
       ElseIf RadioButton11.Checked = True Then
           cmd.Parameters.AddWithValue(":q3", "Average")
       ElseIf RadioButton12.Checked = True Then
           cmd.Parameters.AddWithValue(":q3", "Poor")
       End If

       If RadioButton13.Checked = True Then
           cmd.Parameters.AddWithValue(":q4", "Excellent")
       ElseIf RadioButton14.Checked = True Then
           cmd.Parameters.AddWithValue(":q4", "Good")
       ElseIf RadioButton15.Checked = True Then
           cmd.Parameters.AddWithValue(":q4", "Average")
       ElseIf RadioButton16.Checked = True Then
           cmd.Parameters.AddWithValue(":q4", "Poor")
       End If


       If RadioButton17.Checked = True Then
           cmd.Parameters.AddWithValue(":q5", "Excellent")
       ElseIf RadioButton18.Checked = True Then
           cmd.Parameters.AddWithValue(":q5", "Good")
       ElseIf RadioButton19.Checked = True Then
           cmd.Parameters.AddWithValue(":q5", "Average")
       ElseIf RadioButton20.Checked = True Then
           cmd.Parameters.AddWithValue(":q5", "Poor")
       End If


       If RadioButton21.Checked = True Then
           cmd.Parameters.AddWithValue(":q6", "Excellent")
       ElseIf RadioButton22.Checked = True Then
           cmd.Parameters.AddWithValue(":q6", "Good")
       ElseIf RadioButton23.Checked = True Then
           cmd.Parameters.AddWithValue(":q6", "Average")
       ElseIf RadioButton24.Checked = True Then
           cmd.Parameters.AddWithValue(":q6", "Poor")
       End If


       If RadioButton25.Checked = True Then
           cmd.Parameters.AddWithValue(":q7", "Excellent")
       ElseIf RadioButton26.Checked = True Then
           cmd.Parameters.AddWithValue(":q7", "Good")
       ElseIf RadioButton27.Checked = True Then
           cmd.Parameters.AddWithValue(":q7", "Average")
       ElseIf RadioButton28.Checked = True Then
           cmd.Parameters.AddWithValue(":q7", "Poor")
       End If


       If RadioButton29.Checked = True Then
           cmd.Parameters.AddWithValue(":q8", "Excellent")
       ElseIf RadioButton30.Checked = True Then
           cmd.Parameters.AddWithValue(":q8", "Good")
       ElseIf RadioButton31.Checked = True Then
           cmd.Parameters.AddWithValue(":q8", "Average")
       ElseIf RadioButton32.Checked = True Then
           cmd.Parameters.AddWithValue(":q8", "Poor")
       End If

       cmd.Parameters.AddWithValue(":remarks", lbremarks.Text)
                   cmd.ExecuteNonQuery()


                   Response.Write("<script type=""text/javascript""> alert('Done!');</script>")
   End Sub
Posted
Updated 11-Aug-13 20:27pm
v2
Comments
Mukesh Ghosh 12-Aug-13 2:20am    
Can you provide your current code so that we can check for modification?
Silvabolt 12-Aug-13 15:08pm    
Why do you need to generate an entire HTML page just to display data back to the user? You just need to do as you've already done and tell them 'Thanks for submitting your feedback'.

If you still see a requirement for this, then to be honest, you're doing it wrong. You don't want to have users creating new html pages every time they submit a form. Then you have users creating random pages on your server and they don't even know it! What you want to do is set up label controls with autopostback set to true. Once you have saved data, set the label text values to the saved data. That's all you really need to do. No pages, no hassle, no html generation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900