Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have to list one is ques id and second is option txt and two button i want that when i chose one ques and option and click on button the it will insert in the dataset temporary and when i fill all quset and option then it wil store in databse on scnd butto click.
my code is
VB
Public Sub setques()
       cm = New SqlCommand("select * from ques_mst where ques_id='" & rbl_ques.Text & "'  ", con)
       da = New SqlDataAdapter(cm)
       ds = New DataSet
       da.Fill(ds, "q2")

       If ds.Tables("q2").Rows.Count > 0 Then

           If q <= ds.Tables("q2").Rows.Count Then
               Me.tb_qid.Text = ds.Tables("q2").Rows(q).Item("ques_id").ToString
               Me.tb_ques.Text = ds.Tables("q2").Rows(q).Item("ques_txt").ToString
               q = q + 1
           End If

           cm = New SqlCommand("select * from option_mst where  ques_id  = '" & rbl_ques.SelectedValue & "'", con)
           da = New SqlDataAdapter(cm)
           ds = New DataSet
           da.Fill(ds, "o1")
           rbl_option.Items.Clear()
           If ds.Tables("o1").Rows.Count > 0 Then
               i = ds.Tables("o1").Rows.Count
               c = 0

               While c < i

                   Me.rbl_option.Items.Add(ds.Tables("o1").Rows(c).Item("option_txt").ToString)
                   c = c + 1
               End While
           End If


       End If
       c = 0
       i = 0
   End Sub
   Public Sub getqid()
       cm = New SqlCommand("select * from ques_mst ", con)
       da = New SqlDataAdapter(cm)
       ds = New DataSet
       da.Fill(ds, "q2")
       rbl_option.Items.Clear()
       If ds.Tables("q2").Rows.Count > 0 Then
           i = ds.Tables("q2").Rows.Count
           c = 0

           While c < i

               Me.rbl_ques.Items.Add(ds.Tables("q2").Rows(c).Item("ques_id").ToString)
               c = c + 1
           End While
       End If
       i = 0
       c = 0
   End Sub


   Protected Sub rbl_ques_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rbl_ques.SelectedIndexChanged
       setques()

   End Sub


   Protected Sub b_submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b_submit.Click

       cm = New SqlCommand("select * from feedback_detail_mst where ques_id='" & rbl_ques.SelectedValue & "'", con)
       da = New SqlDataAdapter(cm)
       ds = New DataSet
       da.Fill(ds, "fd")
       If ds.Tables("fd").Rows.Count > 0 Then
           MsgBox("Question already attemped", MsgBoxStyle.Critical, "FACULTY APPRAISAL")
       Else
           ds.Tables("fd").Columns.Add("qid")
           ds.Tables("fd").Columns.Add("option_txt")


           dr(1) = ds.Tables.Add.Rows(1).Item("ques_id").ToString
           'dr(1) = rbl_option.SelectedItem.Text

           MsgBox(dt)
       End If
   End Sub

   Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

   End Sub
Posted
Comments
Muthuraja Irullandi 8-Feb-13 6:46am    
Hi,
Could you please explain the actual issue with your code?
supriya931 13-Feb-13 23:18pm    
actually i want to save all ques in one place and when i click on button then all the question inserted in to database at same time from that place on one click only

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